LogoLogo
OS Docs HomeOS NGDOS APIsOS Download ProductsMore than MapsOS Data Hub
  • Introduction to OS APIs
  • Core Concepts
    • Getting started with an API project
    • Authentication
    • Error codes
    • Rate-limiting policy
    • OS API branding
    • Service level agreements
    • Service availability dashboard
  • Accessing OS APIs
    • OS Maps API
      • Layers and styles
      • Getting started
        • ESRI ArcGIS Online
        • ESRI ArcGIS Pro
        • ESRI ArcMap
        • Cadcorp SIS
        • MapInfo Pro
        • QGIS
      • Technical specification
        • ZXY
        • WMTS
      • Code examples
    • OS Vector Tile API
      • What data is available?
      • Getting started
        • ESRI ArcGIS Pro
        • Cadcorp SIS
        • QGIS
        • Create a web application using the OS Vector Tile API
      • Technical specification
        • Service Metadata
        • Stylesheet
        • Tile request
      • Code examples
      • Stylesheets
    • OS NGD API – Tiles
    • OS NGD API – Features
    • OS Features API
      • OS Product Archive
      • What data is available?
      • Getting started
        • ArcGIS Online
        • ArcGIS Pro
        • ArcMap
        • Cadcorp SIS
        • MapInfo Pro
        • QGIS
      • Technical specification
        • getCapabilities
        • describeFeatureType
        • getFeature
        • Filtering
        • Paging
        • Empty values
      • Code examples
    • OS Names API
      • Getting started with example queries using Node.js
      • Technical specification
        • Find
        • Nearest
      • Code list
      • Code examples
    • OS Linked Identifiers API
      • What data is available?
      • Getting started with implementing a look-up application
      • Technical specification
        • Identifier
        • Identifier Types
        • Feature Types
        • Product Version Information
      • Code examples
    • OS Places API
      • Getting started with example queries using Node.js
      • Technical specification
        • Find
        • Postcode
        • UPRN
        • Nearest
        • BBOX
        • Radius
        • Polygon
      • Datasets
      • Code lists
      • Code examples
    • OS Match & Cleanse API
      • End of Life Information
      • Getting started with an example match query using Node.js
      • Technical specification
      • Datasets
      • Code lists
    • OS Downloads API
      • Getting started
        • Automating OS OpenData downloads
        • Automating OS Premium data downloads
      • Technical specification
        • OpenData products
        • OpenData product details
        • Download an OpenData product
        • OpenData product image
        • Data packages
        • Data package ID
        • Data package version
        • Data package version ID
        • Download a data package
    • OAuth 2 API
      • Getting started
      • Technical specification
  • Additional resources
    • OS API Wrappers
      • JavaScript
      • Python
      • R
  • Extra Links
    • Accessibility
    • Contact us
    • PSGA Product Summary
    • Terms and conditions
Powered by GitBook
On this page
  • What you need
  • Connecting to the API
  • Add a custom style

Was this helpful?

  1. Accessing OS APIs
  2. OS Vector Tile API
  3. Getting started

QGIS

Accessing OS Vector Tile API via QGIS

PreviousCadcorp SISNextCreate a web application using the OS Vector Tile API

Last updated 10 days ago

Was this helpful?

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 that respect the correct text rotation functions that you can apply to the OS Vector Tile API.

What you need

  • OS Vector Tile API added to an API project in the OS Data Hub with an API Key. See Getting started with an API project for more information.

  • QGIS (version 3.22.0 or later)

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.

2

Create a new connection

In the Data Source Manager | Vector Tile dialog:

  • Click New.

  • Select New Generic Connection...

In the Vector Tile Connection dialog:

  • Name: Provide a name for the connection.

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

  • Source URL: Input the 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):

  • {INSERT_YOUR_API_KEY}

  • {INSERT_YOUR_API_KEY}

To learn more about the data available in OS Vector Tile API, please see the .

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:

Add a custom style

1

Find a style

Once you have an existing OS Vector Tile API connection, go to the 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.

3

Update the Style URL connection

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

In the Vector Tiles Connection dialog:

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

  • Click OK.

custom QGIS stylesheets (QML files)
https://api.os.uk/maps/vector/v1/vts/tile/{z}/{y}/{x}.pbf?srs=3857&key=
https://api.os.uk/maps/vector/v1/vts/resources/styles?srs=3857&key=
'What data is available?' page
OS-Vector-Tile-API Stylesheets Repo in GitHub
Retrieve Style
Retrieve Tile
QGIS UI with the Add Vector Tile Layer option selected.
QGIS Data Source Manager | Vector Tile dialog.
QGIS Vector Tiles Connection dialog.
QGIS UI showing OS Vector Tile API in the map area.
GitHub UI with a custom stylesheet file open and the Raw button highlighted.
QGIS Data Source Manager | Vector Tile dialog.
QGIS Vector Tiles Connection dialog.
QGIS Vector Tiles Connection dialog.
QGIS UI showing rendered Vector Tile layer
A  style file open on GitHub with the Raw button highlighted.
 Data Source Manager | Vector Tile dialog
QGIS Vector Tiles Connection dialog
 QGIS Data Source Manager | Vector Tile dialog.
QGIS UI with the Add Vector Tile Layer option selected.