Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
OS NGD API - Tiles Technical Specification provides an overview of the endpoints available, as well as the parameters that can be used with each endpoint. The Technical Specification is intended to be used by customers who want to integrate with the API. Click into each endpoint to learn more.
OS NGD API – Tiles offers you a vector tile service powered by the OS NGD. It provides a detailed and customisable basemap that's based on the latest OGC API – Tiles standard to help you create stunning and interactive web maps. It can be used with most web mapping libraries, including OpenLayers, MapLibre GL JS and Leaflet. The major benefit of vector tiles is that they are optimised for use across the internet and are therefore great for building interactive web maps that allow users to zoom, pan, rotate, tilt and more.
You have a choice between using Ordnance Survey styles or creating your own. You can customise the content and style to create a professional-looking map that perfectly meets your needs, matches your branding, and pleases your customers.
OS NGD API – Tiles is available in two projections: British National Grid for Great Britain (GB) data and Web Mercator, a global coordinate system.
You can:
Use it as a basemap in GIS, web or mobile applications.
View the whole of Great Britain in unrivalled detail.
Seamlessly pan, zoom, pitch and tilt the map.
Overlay your own data on the basemap to give geographic context to your data.
Trace over OS NGD (Premium Data) detailed geometries.
Customise the map style and content to create the map you need.
Access maps in different projections: British National Grid and Web Mercator.
You can't:
Retrieve all the detailed attribution from OS NGD data.
Access data from the:
OS NGD Address Theme,
Routing and Asset Management Information (RAMI) Collection (of the OS NGD Transport Theme).
The following table details the OS NGD datasets that were used to create the OS NGD API – Tiles basemap. The result is a detailed OS basemap that combines OS Open Zoomstack and OS NGD data.
Find out more about the hierarchy of OS NGD data here.
The following table details the OS NGD datasets that can be used as overlays to the basemap to add additional information:
The following attribution is available as part of OS NGD API – Tiles:
The map features do not contain every OS NGD feature type, nor the complete list of attribution available within the feature types that are included; we have purposefully only selected feature types and a subset of attribution from them that are useful for visualisation as this keeps the tiles lightweight and quick to render.
The inclusion of unique identifiers (IDs), where available, allows you to cross-reference with the full product, for example, with OS NGD API – Features. Find out more about OS NGD Unique identifiers.
Although OS NGD API – Tiles will be updated weekly, the data updates are based on the set currency of the OS NGD collections (for example, the Structure Features Collection currency is daily, whereas the Water Network Collection currency is monthly).
Theme | Collection | Feature Type(s) |
---|---|---|
Theme | Collection | Feature Type(s) | Collection ID |
---|---|---|---|
CollectionID | Layer(s) | Available Attribution |
---|---|---|
Collection ID | Update Frequency |
---|---|
Increased data update frequency
OS NGD API - Tiles is updated weekly ensuring you have access to the latest data as quickly as possible.
Beautifully styled basemap, ready to customise
Customise your maps to perfectly meet your needs. You have a choice between using Ordnance Survey styles or creating your own.
Interactive and flexible web maps
Control every aspect of your map with the flexibility to create dynamic interaction with the map and individual features.
Boundary High Water Mark, Ceremonial County, Country, Devolved Parliament Constituency, Devolved Parliament Electoral Region, Electoral Division, GLA Assembly Constituency, Historic County, Historic European Region, Lower Tier Local Authority, Parish Or Community, Polling District, Region, Regional Authority, Upper Tier Local Authority, Ward, Westminster Constituency
asu-bdy
trn-ntwk-railway
wtr-ctch
ngd-base
All
osid, description, name1_text (only applicable to the Named Point, Site and Water Link Set layers), designatedname1_text (only applicable to the Road layer), versionavailablefromdate
asu-bdy
All
osid, description, name1_text (only applicable to the Country layer), name2_text,
pollingdistrictid (only applicable to the Polling District layer), versionavailablefromdate
trn-ntwk-railway
osid, description, railwayuse, operationalstatus, physicallevel, name1_text, versionavailablefromdate
osid, description, versionavailablefromdate
osid,
name1_text,
name2_text,
versionavailablefromdate
wtr-ctch
osid, riverbasindistrictname, versionavailablefromdate
osid, waterbodyname_text, waterbodycategory, versionavailablefromdate
ngd-base
Weekly
asu-bdy
Biannually
trn-ntwk-railway
Monthly
wtr-ctch
Updated as and when updates are received from the authoritative bodies
The following sub-sections provide step-by-step instructions on how to access OS NGD API - Tiles in various GIS software packages.
The following pages provide an overview of how to get started using the OS NGD API - Tiles. They cover the core elements to get started in the most common GIS software and web mapping libraries.
These pages should be used in conjunction with the more detailed pages within the Data Structure section and Technical Specification.
Accessing OS NGD API - Tiles via QGIS
QGIS is an open GIS (Geospatial Information System) desktop application that allows you to display, interrogate, visualise and create geospatial information including from geo-centric APIs (for example, a Vector Tiles Service).
QGIS (version 3.22.0 or later)
Open a blank document in QGIS. Uncheck the "Render" box for now.
Navigate to Layer → Add Layer → Add Vector Tilers Layer...
The following window will be displayed:
Click the New button below the drop-down menu and select New Generic Connection
The window that pops up requires the API information you obtained in the OS Data Hub.
Provide the service details of the API as follows:
Provide a name for the API. It is good practice to name your connections in a way that makes them instantly recognisable.
In the URL box, input the OS NGD API - Tiles URL to retrieve tiles for your preferred collection.
Your API Key, which has been generated in the OS Data Hub.
Set the Min and Max Zoom Levels based on your preferred projection.
Web Mercator (EPSG: 3857): Min Zoom = 6, Max Zoom = 19
British National Grid (BNG: EPSG: 27700): Min Zoom = 0, Max Zoom = 15
In the Style URL box, input the OS NGD API - Tiles style URL to style the tiles based on the default style for the specified collection.
Leave all other options blank and click OK.
To retrieve tiles and style them appropriately, you will need two URLs. The URLs have slight variations based on the collection ID and projection. Here are some example URLs to retrieve the basemap (ngd-base) in Web Mercator (EPSG: 3857):
Please note: You will need to replace the /{tileMatrix}/{tileRow}/{tileCol} used in the default 'retrieve tile' URL with /{z}/{y}/{x} to be able to connect to the OS NGD API - Tiles.
Click Add and Close in the Data Source Manager and you'll see the map displayed in the QGIS screen
{INSERT_YOUR_API_KEY}
{INSERT_YOUR_API_KEY}
To learn more about the available collections in OS NGD API - Tiles, you can view what data is available .
The following sub-sections provide step-by-step instructions on how to access OS NGD data via OS NGD API - Features in various web mapping libraries.
Accessing OS NGD API - Tiles via Leaflet
Leaflet is an open-source JavaScript library for displaying interactive maps on the web or mobile. A simple and lightweight library that will enable you to display and visualise location data and build dynamic applications.
OS NGD API - Tiles added to an API project in the OS Data Hub with an API Key.
A text editor like Visual Studio Code or Notepad to edit and save your HTML and JavaScript files
Create a new HTML file with a text editor (e.g. Notepad, Visual Studio Code).
Add the basic HTML structure to your file with a placeholder <div>
for the map.
To enable access to OS APIs an API key is required. Inside the <script>
tag, add a variable called apiKey
, replacing 'INSERT_API_KEY_HERE'
with the API key from your project.
Inside the <script>
tag, add another variable called collectionId
with the collection ID for the OS NGD API - Tiles base map - ngd-base
We need to intercept and customise the style request, adding a tiles property to provide a correctly formatted URL and authentication through the apiKey is enabled to ensure the correct tiles are requested.
Add the following code inside the Javascript block:
Initialize the map object using the L.Map
class to configure the vector tile layer and the mapOptions
variable to define its properties - minZoom
, maxZoom
, maxBounds
, center
and zoom
.
The above code creates the main map instance using the Leaflet library where you can specify various properties:
minZoom
and maxZoom
: Sets the minimum and maximum zoom level for the map. Users will not be able to go beyond these levels.
maxBounds
: Defines the maximum bounds and restricts panning the map.
center
: Sets the initial center point of the map.
zoom
: Sets the initial zoom level of the map.
Congratulations! You've successfully created a vector map using Leaflet using the OS NGD API - Tiles in a few steps. Continue to explore Ordnance Survey's code examples to learn more about advanced features and functionality such as adding markers, pop-ups, and additional layers.
Accessing OS NGD API - Tiles via MapLibre GL JS
MapLibre GL JS is a free and powerful JavaScript library for displaying interactive maps on the web. It's based on Mapbox GL JS and provides a wide range pf features for creating maps with custom styles, markers and interactivity.
OS NGD API - Tiles added to an API project in the OS Data Hub with an API Key.
A text editor like Visual Studio Code or Notepad to edit and save your HTML and JavaScript files
Create a new HTML file with a text editor (e.g. Notepad, Visual Studio Code).
Add the basic HTML structure to your file with a placeholder <div>
for the map.
To enable access to OS APIs an API key is required. Inside the <script>
tag, add a variable called apiKey
, replacing 'INSERT_API_KEY_HERE'
with the API key from your project.
Inside the <script>
tag, add another variable called collectionId
with the collection ID for the OS NGD API - Tiles base map - ngd-base
We need to intercept and customise the style request, adding a tiles
property to provide a correctly formatted URL and authentication through the apiKey
is enabled to ensure the correct tiles are requested.
Add the following code inside the Javascript block:
Initialize the map object using the maplibregl.Map
class to configure the vector tile layer and define its properties - container
, minZoom
, maxZoom
, maxBounds
, style
, center
and zoom
.
Add navigation controls to the map, excluding the compass button and disabling map rotation.
The above code creates the main map instance using the MapLibre GL JS library where you can specify various properties:
container
: Defines where the map should be displayed, in this instance it is set to the ID
of the <div>
element.
minZoom
and maxZoom
: Sets the minimum and maximum zoom level for the map. Users will not be able to go beyond these levels.
maxBounds
: Defines the maximum bounds and restricts panning the map.
style
: Defines the style of the map, configured via a URL pointing at the default style for the 'collectionId
' defined.
center
: Sets the initial center point of the map.
zoom
: Sets the initial zoom level of the map.
Congratulations! You've successfully created a vector map using MapLibre GL JS using the OS NGD API - Tiles in a few steps. Continue to explore Ordnance Survey's code examples to learn more about advanced features and functionality such as adding markers, pop-ups, and additional layers.
Accessing OS NGD API - Tiles via OpenLayers
OpenLayers is easy to use and can be integrated with a variety of other web development frameworks.
OS NGD API - Tiles added to an API project in the OS Data Hub with an API Key.
A text editor like Visual Studio Code or Notepad to edit and save your HTML and JavaScript files
Create a new HTML file with a text editor (e.g. Notepad, Visual Studio Code)
Add the basic HTML structure to your file with a placeholder <div>
for the map.
To enable access to OS APIs an API key is required. Inside the <script>
tag, add a variable called apiKey
, replacing 'INSERT_API_KEY_HERE'
with the API key from your project.
Inside the <script>
tag, add another variable called collectionId
with the collection ID for the OS NGD API - Tiles base map - ngd-base
To correctly render the vector tiles within OpenLayers, you will need to fetch
the defined EPSG:3857 Tile Matrix Set and style definitions from the OS NGD API - Tiles service. The two endpoints provide information about the structure of the vector tiles and how the styles are to be applied.
A promise.all
is used to process the data to ensure that both requests are completed before proceeding.
Based on the fetched Tile Matrix Set data, a tile grid is defined using the ol.tilegrid.TileGrid class. The tile grid provides information about the resolution, origin and tile sizes to handle the vector tiles correctly.
Add the following code inside the Javascript block:
Define the a new vector tiles layer and source that will be used to fetch vector tiles from the OS NGD API - Tiles. The ol.layer.VectorTile
uses a ol.source.OGCVectorTile
source to retreive tiles from the API.
After creating the vector layer, you will need to use a style function to ensure that the Ordnance Survey style are applied to each tile. Using the olms.applyStyle
function to retrieve the style sheets available for the base map.
Initialize the map object using the ol.map
class to configure the vector tile layer and define its properties - target
, layers
and view
The above code creates the main map instance using the OpenLayers library where you can specify various properties:
target
: Defines where the map should be displayed, in this instance it is set to the ID
of the <div>
element.
layers
: An array containing the layers to be added to the map.
view
: Defines the initial view of the main, containing various settings such as projection, extent (the geographic bounds of the map), minimum and maximum zoom levels, centre of the map and the initial zoom level.
is a free and open-source JavaScript library for displaying interactive maps on the web. It is a powerful tool that can be used to create a wide variety of map-based applications, from simple web maps to complex GIS applications.
Congratulations! You've successfully created a vector map using OpenLayers using the OS NGD API - Tiles in a few steps. Continue to explore Ordnance Survey's to learn more about advanced features and functionality such as adding markers, pop-ups, and additional layers.
Local identifier of a collection
An identifier representing a specific style.
OK
Local identifier of a collection
An identifier representing a specific style.
Styling resourece base name.
"sprites"
OK
The URIs of all conformance classes supported by the server
Identifier selecting one of the scales defined in the TileMatrixSet and representing the scaleDenominator the tile.
"15"
Row index of the tile on the selected TileMatrix.
11179
Column index of the tile on the selected TileMatrix.
16558
Local identifier of a collection
A vector tile returned as a response.
Identifier selecting one of the scales defined in the TileMatrixSet and representing the scaleDenominator the tile.
"15"
Row index of the tile on the selected TileMatrix.
11179
Column index of the tile on the selected TileMatrix.
16558
Local identifier of a collection
Identifier for a supported TileMatrixSet
A vector tile returned as a response.
The landing page provides links to the API definition (link relation service-desc
, in this case path /api
), to the Conformance declaration (path /conformance
, link relation conformance
), and to the Collections of geospatial data (path /collections
, link relation data
).
While a title is not required, implementors are strongly advised to include one.
"OS NGD API"
"Ordnance Survey National Geographic Database API."
The attribution
should be short and intended for presentation to a user, for example, in a corner of a map. Parts of the text can be links to other resources if additional information is needed. The string can include HTML markup.
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"
List of tile matrix sets (tiling schemes).
Optional local tile matrix set identifier, e.g. for use as unspecified {tileMatrixSetId}
parameter. Implementation of 'identifier'
Title of this tile matrix set, normally used for display to a human
Reference to an official source for this tileMatrixSet
Reference to one coordinate reference system (CRS)
Links to related resources. A 'self' link to the tile matrix set definition is required.
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"
Local identifier of a collection
List of available styles.
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"
Local identifier of a collection
List of available tilesets.
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"
identifier of the tile matrix set
"3857"
A title for this tileset
Type of data
Reference to one coordinate reference system (CRS)
Reference to a Tile Matrix Set on an offical source for Tile Matrix Sets such as the OGC NA definition server (http://www.opengis.net/def/tms/). Required if the tile matrix set is registered on an open official source.
Links to related resources. A 'self' link to the tileset as well as a 'http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme' link to a definition of the TileMatrixSet are required.
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"
The collections of (mostly geospatial) data available from this API. The dataset contains one or more collections. This resource provides information about and access to the collections. The response contains the list of collections. Each collection is accessible via one or more OGC API set of specifications, for which a link to relevant accessible resources, e.g. /collections/{collectionId}/(items, coverage, map, tiles...) is provided, with the corresponding relation type, as well as key information about the collection. This information includes:
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"
identifier of the collection used, for example, in URIs
"buildingpart"
human readable title of the collection
"Building Part"
a description of the data in the collection
"Polygon feature representing a building."
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"
The extent module only addresses spatial and temporal extents. This module extends extent by specifying how intervals and crs properties can be used to specify additional geometries.
The spatial extent of the data in the collection.
One or more bounding boxes that describe the spatial extent of the dataset. In the Core only a single bounding box is supported.
Extensions may support additional areas. The first bounding box describes the overall spatial extent of the data. All subsequent bounding boxes describe more precise bounding boxes, e.g., to identify clusters of data. Clients only interested in the overall spatial extent will only need to access the first item in each array.
Coordinate reference system of the coordinates in the spatial extent
(property bbox
). The default reference system is WGS 84 longitude/latitude.
In the Core the only other supported coordinate reference system is
WGS 84 longitude/latitude/ellipsoidal height for coordinates with height.
Extensions may support additional coordinate reference systems and add
additional enum values.
Local identifier of a collection
Information about a particular collection of (mostly geospatial) data available from this API. The collection is accessible via one or more OGC API set of specifications, for which a link to relevant accessible resources, e.g. /collections/{collectionId}/(items, coverage, map, tiles...) is contained in the response, with the corresponding relation type, as well as key information about the collection. This information includes:
identifier of the collection used, for example, in URIs
"buildingpart"
human readable title of the collection
"Building Part"
a description of the data in the collection
"Polygon feature representing a building."
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"
The extent module only addresses spatial and temporal extents. This module extends extent by specifying how intervals and crs properties can be used to specify additional geometries.
The spatial extent of the data in the collection.
One or more bounding boxes that describe the spatial extent of the dataset. In the Core only a single bounding box is supported.
Extensions may support additional areas. The first bounding box describes the overall spatial extent of the data. All subsequent bounding boxes describe more precise bounding boxes, e.g., to identify clusters of data. Clients only interested in the overall spatial extent will only need to access the first item in each array.
Coordinate reference system of the coordinates in the spatial extent
(property bbox
). The default reference system is WGS 84 longitude/latitude.
In the Core the only other supported coordinate reference system is
WGS 84 longitude/latitude/ellipsoidal height for coordinates with height.
Extensions may support additional coordinate reference systems and add
additional enum values.
Identifier for a supported TileMatrixSet
tile matrix set
Title of this tile matrix set, normally used for display to a human
Tile matrix set identifier. Implementation of 'identifier'
Reference to an official source for this tileMatrixSet
Reference to one coordinate reference system (CRS)
Reference to a well-known scale set
Describes scale levels and its tile matrices
Identifier selecting one of the scales defined in the TileMatrixSet and representing the scaleDenominator the tile. Implementation of 'identifier'
Scale denominator of this tile matrix
Cell size of this tile matrix
The corner of the tile matrix (topLeft or bottomLeft) used as the origin for numbering tile rows and columns. This corner is also a corner of the (0, 0) tile.
Precise position in CRS coordinates of the corner of origin (e.g. the top-left corner) for this tile matrix. This position is also a corner of the (0, 0) tile. In previous version, this was 'topLeftCorner' and 'cornerOfOrigin' did not exist.
Width of each tile of this tile matrix in pixels
Height of each tile of this tile matrix in pixels
Width of the matrix (number of tiles in width)
Height of the matrix (number of tiles in height)
Local identifier of a collection
Identifier for a supported TileMatrixSet
Description of the tileset
identifier of the tile matrix set
"3857"
A title for this tileset
Type of data
Reference to one coordinate reference system (CRS)
Reference to a Tile Matrix Set on an offical source for Tile Matrix Sets such as the OGC NA definition server (http://www.opengis.net/def/tms/). Required if the tile matrix set is registered on an open official source.
Links to related resources. A 'self' link to the tileset as well as a 'http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme' link to a definition of the TileMatrixSet are required.
Supplies the URI to a remote resource (or resource fragment).
"http://data.example.com/buildingpart/123"
The type or semantics of the relation.
"alternate"
A hint indicating what the media type of the result of dereferencing the link should be.
"application/geo+json"
This flag set to true if the link is a URL template.
A base path to retrieve semantic information about the variables used in URL template.
"/ogcapi/vars/"
A hint indicating what the language of the result of dereferencing the link should be.
"en"
Used to label the destination of a link such that it can be used as a human-readable identifier.
"Building Part"