Introducing our API
We’re very pleased to announce the initial availability of our API. This is the same API that powers MNB Assess, our site assessment reporting tool focused on new-build developments. The API comprises two main parts - Tiles and Titles. You can checkout the documentation right now, or read on for an overview of these two resources.
Working with geospatial data can involve a lot of legwork. Different sets of data come from different suppliers in different formats. To actually display this data on a map, you need to download the data from the source, clean it up and coerce it into a suitable format for displaying it on the web, and then serve the cleaned data to your clients.
One of the first things we did at MyNestBox was to build a robust Extract, Transform and Load (ETL) pipeline to help us stay on top of our data. This pipeline takes in data in many formats - usually shape files or CSVs - checks the coordinates reference system (CRS) and reprojects it into our preferred CRS if required (4326), stores the result in a relational database and finally uses that data to create Mapbox Vector Tiles for each data set (where appropriate).
The result is a collection of easy-to-use tiles served from the
/tiles endpoint of our API. This makes rendering things like the
radon levels, designated green belt and more (~20 data sets in total)
for the whole of the U.K. a snap. Check out our interactive
maps for an example of
the tiles endpoint in action.
Putting data on a map is great, but when it comes to property we wanted
to be able to provide more insight than just plotting a boundary. Our
/titles endpoint allows us to bring back the geometry data
for any title number in the HMLR database enriched with additional
information. Currently this information is limited but we’ll be adding
more information over time.
Right now, for any title in the country, the
/titles endpoint can
tell you how the title relates to its nearest green belt, Area of
Outstanding Natural Beauty (AONB), Lower Super Output Area (LSOA) and
Local Authority District (LAD). For each of these data sets, the
/titles response for a given title number will tell you if the title
is fully within or partially within an area of the given designation
and, if not, tell you the distance in meters to the nearest one.
/titles endpoint also includes information such as
the tenure of the title (if it’s freehold or leasehold), the total area
of the title and the Local Authority (or Local Authorities if the title
spans a border) that the title is represented by.
Responses from the
/titles endpoint are in the GeoJSON “Feature”
format which again makes it really easy to load them onto a map.
/titles/search endpoint allows us to search for titles
within a specified radius of a given point. This is how we do our
address-based search for our Initial Site Assessment product. The
relationship between addresses and entries in the HMLR database is a
complicated one and outside the scope of this article, but suffice to
say that they don’t quite match up.
In order to get from an address to a title number (and the associated
detailed information we are now able to return for that title number)
we geocode the address to get a “point” and then call the
/titles/search endpoint with the point and a value representing the
radius around that point in which we’d like to search. The response
will include the geometry and title number (only) for any titles that
intersect the search area which allows us to easily render these on the
map. Once the user chooses the title they are interested in assessing,
we then make a second call to the
/titles endpoint for the full
details of the title and begin our assessment flow.
Again, search results are returned in the GeoJSON format, though this time as a “FeatureCollection” containing multiple “Feature” objects for easy display on a map.
Using the API
The API is still very much in its infancy and we expect it to evolve over time. However, we are using it in production and it has made the development of our Initial Site Assessment product not only easier, but possible. If you think the API might be useful for your idea, product or business, we would love to chat with you about that some more. Please get in touch and let us know what you’re working on.