The OS Data Hub explained: when detail matters
Tags: ordnancesurvey, webdev, geospatial, tutorial
Published: 2021-09-22 11:36:26

###A comprehensive look at what the OS Data Hub is and the APIs that are accessible.

**Ordnance Survey, a data company?**
Fundamentally, Ordnance Survey (OS) is a data company and has been capturing information about Great Britain for almost 230 years. Our original purpose was to create a map in 1801 that would help the military defend and protect the nation. Our aerial imagery techniques helped support surveyors on foot 100 years ago. In the 1940s we were providing an advisory role to international governments on mapping and surveying; and in the 1960s we were mapping government sites.

We’ve developed digital maps of Mars and even used [OS OpenData](https://osdatahub.os.uk/downloads/open?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained) to recreate a map of Great Britain in Minecraft.

[Throughout its history](https://www.ordnancesurvey.co.uk/newsroom/blog/top-10-mapping-moments-in-the-history-of-os?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained), OS has always been at the cutting-edge of location data technology, and its capture and storage. In the early days, surveyors would go out into the wilderness to record waypoints, write them in ledgers and take them back to the office to create an archive of paper maps. However, in the last 50 years, OS has transitioned to capturing and storing this information in digital forms, and as a result, has a huge range of geospatial data about Great Britain that has been included in its data products.

**What is the OS Data Hub?**
[The OS Data Hub](https://osdatahub.os.uk/?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained) is our new platform to serve trusted, authoritative data through new formats to end users. It’s focused on building new efficient ways to access OS data and is a portal for mapping, data, and/or Application Programming Interfaces (APIs).

For those who are not familiar with the term, APIs are services that submit requests to servers and specify the data you want, which is then sent back to you immediately. Think of the restaurant analogy; where you submit your dinner ‘request’ to a server, who will provide this information to the kitchen, who cooks and prepares your order, and then brings your requested order to the table. APIs are essentially important middleware, and programmatically speaking, can reduce technical barriers to entry and the overheads associated with using large, complex datasets.

The OS Data Hub delivers the foundational layer to many geospatial applications. OS makes around 20,000 updates to the database every day. This trusted layer of detailed geospatial data can be pulled into many different use cases including data visualisation, geospatial analysis, and creating business insights. Even within the world of academia, OS data is helping to answer new and interesting geospatial theories.

The data is served through OS APIs in either the British National Grid or Web Mercator standards, and is interoperable with different software and mapping libraries. There are various types of online documentation including [code examples](https://labs.os.uk/public/os-data-hub-examples/?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained) where developers can copy and paste, add in their API keys, and start using OS data within minutes.

The OS Data Hub also has an error reporting tool to feedback about the data, so if you identify errors with the location information, you can report this directly to OS.

**The difference between Open and Premium data**
The signup process provides the technical and pricing information to choose between OS OpenData, Premium and Public Sector plan (Public Sector plan users will need to be a PSGA member).

The OS OpenData plan provides free and unlimited usage but with a data limit determined by the detail. The APIs can be used to view and integrate publicly-accessible datasets and to understand the capabilities of the data within the OS Data Hub. Users can also download the datasets to query offline.

The Premium plan provides access to premium OS datasets where the requests and transactions contain a price. The OS Data Hub provides users free premium data (API transactions) up to £1,000 per month and [information around how much each transaction costs](https://osdatahub.os.uk/plans?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained) so you can estimate the cost based on your usage, to support any budgeting.

The OS Data Hub comes with a dashboard to track progress of API usage. API Projects can help you organise your keys (think of servicing different customers or different websites that you are using) and track the overall usage of the applications you are using OS data on, in more sophisticated ways. Within an API Project you can select several APIs and your key is then directly linked to them all.

**OS Data Hub: the API suite**
OS provides APIs in three broad categories; maps, address data, and geographic features.

**OS Maps API** is a raster tile service that serves maps as PNG images, which are assembled in your browser or GIS. There are two ways to access OS Maps API; Open Geospatial Consortium (OGC) standard web map tile service (WMTS) and ZXY, meaning these maps work with almost all geospatial software and every mapping library. OS Maps API styles are designed and developed by OS cartographers with different features and visual hierarchies.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tt1qhps1nnss5vj1s3hn.png) 

**Using OS APIs for quicker updates**
The OS Maps API is useful for base mapping. For example, the [National Library of Scotland](https://www.ordnancesurvey.co.uk/newsroom/blog/comparing-past-present-new-os-maps-api-layers?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained), which is a repository for historical maps and provides a tool where users can view historical maps and compare them against modern versions. Analysts of The National Library of Scotland originally downloaded large files of OS Maps onto local servers, which meant there could have been gaps of up to two years before updated basemaps were used in their application. Now the analysts have integrated OS Maps API that are connected to OS servers, they are using the most up to date basemaps by only having to change a couple of lines of JavaScript code.

OS Vector Tile API provides an on-demand and quick way to create maps for web and mobile users using OS cartography. The advantage is that vector features are rendered within the browser or client. This means its capable of supporting more interactivity and online experiences and its compatible with common web mapping libraries and increasingly more GIS software. The Vector Tile API is fully customisable not only for individual layers but also individual features.

The Vector Tile API is used with GeoAR.it, an augmented reality company for the environment. It uses vector tiles to create 3D extruded buildings. Every geographic feature can have metadata or attributes that hold relevant details about that feature. Within the Vector Tile API, building footprints have a feature called the building height attribute, a number that represents the height of that building. GeoAR have extruded out the polygons to recreate a 3D model as a city, using the Vector Tile API, to use in this augmented reality environment.

**OS Features API** is used to access the geometries and attribution of OS data. It provides rich geographic vector features in either GeoJSON or GML formats. In addition to the geospatial data (geometries), you receive a set of metadata that is connected to that feature, which are called attributes. In a GIS application, you can examine an attribute table such as address, area, postcodes etc.

The OS Features API provides many data layers, including OS MasterMap Topography Layer. The user specifies the details of the data they need; for example, results that match a building or road, or a spatial query including features that intersect a property. The OS Features API removes overhead of managing and storing the data locally.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/me12ljsfda3xvrtir4zh.png)
 

**Achieve detailed location analysis without surveying**
Start-up Balkerne uses OS Features API to conduct location intelligence risk analytics for customers. The data provided via the API helps Balkerne achieve an advanced understanding of which areas of their properties are at risk of natural disasters, such as floods or subsidence. They can perform this location risk analysis, without having to send out surveyors of their own to inspect a given area.

**OS Linked Identifiers API**
Across OS and UK government, a number of geospatial databases store data for several purposes, such as UK highways and Land Registry. Each of these databases require a unique ID to look up the correct data using analytical processes. The community and Government have agreed on providing unique reference numbers that can be attached to a property, street, or topographic feature through its lifecycle. These include the Unique Property Reference Number (UPRN), Unique Street Reference Number (USRN) and OS also provides the Topographic identifier (TOID).

The Linked Identifiers API enables correlation between all these reference points.

OS has individual features associated with their datasets. However, within the Land Registry database, they may have one UPRN that is associated with a single structure. The Linked Identifiers API allows you to query a UPRN and it will correlate and send back all the TOIDs connected to that UPRN. There is no geospatial data returned by the Linked Identifiers API, but it is a way to link between several different database that use multiple reference systems.

**OS Names API** is a free-to-use searchable database to help the user find and verify populated places, cities, roads, and postcodes within Great Britain. To find ‘Southampton’ from the API perspective, when sending a request with the string of ‘Southampton’, it will pull out searches related to that request. Information will include where the location is, its size, and the map view will zoom directly to that location. The OS Names API enables forward and reverse geocoding, and links diverse information such as a statistics or descriptions to locations.

**OS Downloads API** automates the discovery and download of OS OpenData. It enables users to work with bigger datasets, even within the capability of hosting them on their own servers, or to do some country-scale analytics. Users are able to request various coverage areas, metadata, and data format depending on the dataset. From October 2021, it will also include OS premium datasets including OS MasterMap Topography Layer and AddressBase Premium.

**OS Places API and OS Match & Cleanse API** are address APIs and contain AddressBase Premium data. Users can use these APIs for forward and reverse geocoding of detailed address data, which includes a UPRN for linking and sharing. The GeoSearch function allows the user to search for addresses using bounding box, radius, and polygon queries. Both address APIs can save the user time, ensure they capture the correct address details at source, and help minimise errors in their own databases.

**Accessing the OS Data Hub**
Any developers, data scientists, or GIS users can access the OS Data Hub using standard protocols for accessing information over the internet and using the standard format for requesting and retrieving data.

For [web developers](https://labs.os.uk/public/os-data-hub-tutorials/web-development/automated-open-data-download?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained), connect with libraries such as Leaflet, OpenLayers, Mapbox GL JS and ArcGIS for JavaScript. All libraries have, native to their functionality, ways to connect to the OS Data Hub in several standard data formats.

For [data scientists](https://labs.os.uk/public/os-data-hub-tutorials/data-science/price-paid-spatial-distribution?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained), use Python and R libraries, including Geopandas and Jupyter Notebook for fetching data over an http request. This is more around structuring those requests so they comply with how the OS Data Hub APIs are expecting to receive the request and will send the data back.

[GIS analysts](https://labs.os.uk/public/os-data-hub-tutorials/gis-applications/3d-flood-modelling?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained) can use OS APIs to pull the basemaps into their workflows and connect to rich geospatial features directly, along with attribution, for the areas you want to analyse. It’s about using the right data, as and when you need it.

Most trends in software development are due to their ability to do something easier, cheaper, and/or more efficiently. The OS Data Hub encompasses 230 years of mapping and geospatial expertise; it has undertaken and managed the technical GIS burden, in addition to the heritage associated with OS, to allow the developer to use and manage geospatial data through simple and easy-to-access APIs.

**For more information visit [osdatahub.co.uk](https://osdatahub.os.uk/?utm_source=devto&utm_campaign=devrel&utm_content=data-hub-explained).**