QGIS

Accessing OS Vector Tile API 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 currently does not fully support all the text rotation functions that are supplied in the style JSON files

Therefore, we've created custom QGIS stylesheets (QML files) that respect the correct text rotation functions that you can apply to the OS Vector Tile API.

What you need

Connecting to the API

1

Set up a new connection

Once a new project with a base map has been set up, select Layer > Add Layer > Add Vector Tile Layer.

QGIS UI with the Add Vector Tile Layer option selected.
QGIS UI with the Add Vector Tile Layer option selected.
2

Create a new connection

In the Data Source Manager | Vector Tile dialog:

  • Click New.

  • Select New Generic Connection...

 QGIS Data Source Manager | Vector Tile dialog.
QGIS Data Source Manager | Vector Tile dialog.

In the Vector Tile Connection dialog:

  • Name: Provide a name for the connection.

  • Style URL: Input the Retrieve Style request URL for the OS Vector Tile API.

  • Source URL: Input the Retrieve Tile request URL for the OS Vector Tile API.

  • Min. and Max. Zoom Levels: Set these as follows:

    • Web Mercator (EPSG: 3857): Min. Zoom Level = 6; Max. Zoom Level = 19

  • Authentication: Leave these settings at their defaults.

  • 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 tileset and projection.

Here are some example URLs to retrieve the basemap in Web Mercator (EPSG: 3857):

To learn more about the data available in OS Vector Tile API, please see the 'What data is available?' page.

QGIS Vector Tiles Connection dialog.
QGIS Vector Tiles Connection dialog.
3

Add a layer

Navigate to Layer > Data Source Manager > Vector Tile.

In the Data Source Manager | Vector Tile dialog:

  • Select your new connection to OS Vector Tile API.

  • Click Add.

The layer will then display in the Layers panel and the data will display on the map:

QGIS UI showing rendered Vector Tile layer
QGIS UI showing OS Vector Tile API in the map area.

Add a custom style

1

Find a style

Once you have an existing OS Vector Tile API connection, go to the OS-Vector-Tile-API Stylesheets Repo in GitHub and select the required style file.

2

Get a Style URL

With the custom stylesheet file open:

  • Click Raw (a new window will open).

  • Copy the URL to link to the style JSON file.

A  style file open on GitHub with the Raw button highlighted.
GitHub UI with a custom stylesheet file open and the Raw button highlighted.
3

Update the Style URL connection

In QGIS, open the Data Source Manager | Vector Tile dialog and click Edit.

 Data Source Manager | Vector Tile dialog
QGIS Data Source Manager | Vector Tile dialog.

In the Vector Tiles Connection dialog:

  • Replace the Style URL with the URL to the custom style JSON.

  • Click OK.

QGIS Vector Tiles Connection dialog
QGIS Vector Tiles Connection dialog.

Last updated

Was this helpful?