Using the OS Features API
What is the OS Features API?
OS Features API gives you simple access to in-life OS Data such as OS MasterMap Topography Layer and OS Open Zoomstack.
The OS Features API allows you to:
Request specific feature types and their attributes using spatial or attribute queries.
Visualise and style Ordnance Survey data.
Interrogate highly detailed feature information, including OS MasterMap Topography Layer.
Create and apply your own styling preferences.
The API uses content from various OS data products, such as OS MasterMap Topography Layer and OS MasterMap Highways.
The technical specification on the OS Data Hub goes into detail about the products accessible through the API
How do I access the API?
You can get access to the API through the OS Data Hub. The getting started guide can be accessed here.
Your API key can be found in the API Dashboard by clicking ‘Add to Project’ under the OS OS Features API section
You will now be able to find the API EndPoint address with your API key under your projects
With your API key you can access the API through GIS Software (such as QGIS and Cadcorp) and through programming languages such as Python and R.
The getting started guide has a walkthrough on getting the API in QGIS.
Example scripts for getting started with the API can be found online with code examples for various functions (for example showing features, finding the nearest feature) on OS labs
What are the main benefits of the API?
Plug and play – easily set up in QGIS to explore NGD data
More flexible – pull in exactly the data you want
No ordering or waiting – less time processing and storing data
Easy Testing – great for quick and easy analysis of features
The table below shows the attributes that are available to query against on top of the options available in Select + Build.
You can also access a product archive – through the following endpoint https://api.os.uk/features/v1/wfs/archive/{year} and there is a separate page on this here.
How is the OS Features API different to the OS NGD API - Features?
The main difference between the new OS NGD API – Features and the OS Features API is the OS NGD API – Features is for accessing OS NGD data.
OS NGD attribution can be explored through the OS NGD layers found in the OS NGD API – Features API
Limitations
There are a number of considerations to keep in mind when using the API.
Limits- the API can return 100 features in a single call. Most GIS software will keep calling the API to bring in the requested features so it is important to set a feature limit when setting up the API. Pagination will be required when using a scripting language, this is explained in the next side.
Scale- the API is not designed to create a scalable map of Great Britain across zoom levels. It is designed to interrogate specific features and small areas.
Support – the API is not currently supported by all GIS software.
Pagination
The API returns 100 features per page and the JSON response will include the URL for the following page
Most GIS already understand how to page as its part of the OGC standard. So remember to set limits to avoid calling back the entire country.
However, when using a scripting language you will need to page through the results by utilising the offset attribute.
An example of how to page through features can be found here.
Resources
There are a number of resources available for the OS Features API:
The Data Hub contains an overview of the API, a getting started guide and a technical specification
There are a series of code examples to help you get started with the API
More resources, including style sheets and example scripts, are available on GitHub
Last updated