QGIS
Accessing OS NGD data with OS NGD API – Tiles via QGIS
Last updated
Accessing OS NGD data with OS NGD API – Tiles via QGIS
Last updated
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).
The instructions that follow demonstrate how to connect to OS NGD API – Tiles using QGIS.
QGIS (version 3.22.0 or later).
OS NGD API – Tiles added to an API project in the OS Data Hub with an API Key. See for more information.
Open an existing project or create a new one.
Deselect the Render checkbox in the bottom bar, if necessary.
Navigate to Layer > Add Layer > Add Vector Tile Layer...
In Data Source Manager | Vector Tile, click the New button below the drop-down menu and select New Generic Connection...
The Vector Tiles Connection dialog that pops up requires you to input the API information you obtained in the OS Data Hub.
In the Vector Tiles Connection dialog, provide the service details of the API:
Name: Provide a name for the connection. It is good practice to name your connections in a way that makes them instantly recognisable. You can reuse this connection in the future.
URL: Copy the OS NGD API – Tiles endpoint address from the OS Data Hub and paste it into this field.
Your API Key is automatically appended to this URL in the key
parameter.
Min. and Max. Zoom Levels: Set these as follows 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
Style URL: Input the OS NGD API – Tiles style URL to style the tiles based on the default style for the specified OS NGD collection.
Authentication: Leave these settings at their defaults. You do not need a username or password as authentication is done through your API Key.
Other: Leave all other settings at their defaults.
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):
https://api.os.uk/maps/vector/ngd/ota/v1/collections/ngd-base/styles/3857?key={INSERT_YOUR_API_KEY}
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 OS NGD API – Tiles.
In Data Source Manager | Vector Tile, click Add and Close. You'll then see the map displayed in the main QGIS UI.
To learn more about the available collections in OS NGD API – Tiles, you can view what data is available .