# Zoomstack vector tiles

## What are vector tiles? <a href="#id-2.1-what-are-vector-tiles" id="id-2.1-what-are-vector-tiles"></a>

<figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2Fa6YRUHxInS4uGWWbFKPS%2F1.jpeg?alt=media" alt="Map representation of an area containing geographic information layers including buildings, roads, rivers, and greenspaces" width="563"><figcaption><p>Representation of Zoomstack data in Vector Tile format</p></figcaption></figure>

A vector tile represents a specific area of the earth’s surface and contains geographic information about the coverage area. Each tile can contain many layers of features such as buildings, roads, rivers, greenspaces, etc. They are packets of geographic data, packaged into tiles for transfer over the web. The information they contain can be used to deliver styled web maps to the end-user.

OS supplies data in the Mapbox Vector Tile Specification, packed in a single [MBTiles](https://www.mapbox.com/help/define-mbtiles/) file (which is based on the SQLite database).

## What are the benefits of vector tiles? <a href="#id-2.2-what-are-the-benefits-of-vector-tile" id="id-2.2-what-are-the-benefits-of-vector-tile"></a>

Vector tiles offer users the following benefits:

* Styling - customise your map with full and dynamic design control.
* File size - lightweight tiles that are efficient and super-fast to render in the client.
* Pixel perfect - high resolution, beautiful mapping for all devices.
* Open standard - created under a [Creative Commons Attribution 3.0 US License.](https://creativecommons.org/licenses/by/3.0/us/)
* Smooth - an improved, seamless user experience when zooming in and out of maps.
* Advanced features - Vector Tiles contain actual geographic data (not just images) which can be interrogated and analysed.
* Offline maps - store the tiles locally to take your maps offline.

With Zoomstack vector tiles you get one single MBTiles file that is around 3GB in size. It is light enough to be fast on the web and suitable for offline use. OS has pre-selected the right content for each zoom level and supply stylesheets to give you a great starting point. This can save a considerable amount of time and effort.

The instructions that follow are for installing Zoomstack Vector Tiles in Mapbox Studio, Cadcorp SIS Desktop, and QGIS. Please refer to the relevant section based on the GIS software you’re using. Note that the GIS software packages above were used for demonstrative purposes in this guide and that many other GIS software applications can be used with the Zoomstack product.

<details>

<summary>Mapbox Studio</summary>

[Mapbox Studio](https://www.mapbox.com/mapbox-studio/) is a web application for creating custom maps. It allows you to manage and create datasets, tilesets, and map styles to produce maps with the features and the look and feel you want.

We recommend using [Google Chrome](https://www.google.co.uk/chrome/) for the best results.

The following instructions demonstrate how to install Zoomstack Vector Tiles using Mapbox Studio:

1. Download the [Vector Tiles (MBTiles).](https://www.ordnancesurvey.co.uk/opendatadownload/products.html#ZMSTCK)
2. Go to [Mapbox.com](https://www.mapbox.com/) and sign in.<br>

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FyQDJ7k4QGZvyGFtjzmzc%2F2.jpeg?alt=media" alt="Mapbox sign in page showing an empty login form"><figcaption><p>Mapbox sign in page</p></figcaption></figure>

If you don’t have a Mapbox Account, then create one by clicking on ‘Sign up for Mapbox’.

A Pay-As-You-Go account will be fine for this purpose – it is free to get started and doesn’t require any payment details.

3. Once signed in, click on *Studio* in the top right corner.<br>

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FPbi1uf2PKkibQuF0cQuX%2F3.jpeg?alt=media" alt="Mapbox user meny showing Account, Studio, and Documentation page buttons"><figcaption><p>Mapbox menu</p></figcaption></figure>
4. Click on the *Tilesets* tab in the top right corner.

<img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FMhibyPpZH9of5anciuhO%2F4.png?alt=media" alt="mapbox studio toolbar showing Styles, Tilesets, and Datasets buttons" data-size="original">

5. Click on the *New Tileset* button.

![New tileset button](https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FOjPsZAwfrpEYRGvX8o0x%2F5.jpeg?alt=media)

6. Click on *Select a file*.

![New tileset dialog menu](https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FT6k4qoINIBGDZrEQOc5X%2F6.png?alt=media)

7. Navigate to the *OS\_Open\_Zoomstack.mbtiles* file and click *Open* and then click *Confirm*.<br>

<img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FQ5avgVtDpnTywbtbacoe%2F7.jpeg?alt=media" alt="Upldoad file Mapbox dialog" data-size="original">

Mapbox Studio will then begin to upload and process your data and you will see a progress notification in the bottom right corner.

This will take a while, but you must stay on the page while it's processing.

You will see a notification in the bottom right. First it will say *Uploading* and then move on to *Processing*.

<img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2F1aFTFEQAEpXzW55KKX4d%2F8.png?alt=media" alt="File upload notification" data-size="original">

You may need to refresh the page eventually for it to complete the processing. We would recommend waiting 30 minutes before refreshing.

Once uploaded, it will appear in your list of Tilesets.

### Using OS styles to get started in Mapbox Studio <a href="#id-2.3.1-using-os-styles-to-get-started-in" id="id-2.3.1-using-os-styles-to-get-started-in"></a>

OS has supplied Mapbox GL Styles created by our cartographic designers for use in Mapbox Studio. These stylesheets allow you to add colours to features contained in the Vector Tiles to produce a far more vivid and visually appealing map.

The steps that follow guide you through setting up Mapbox GL Styles in Mapbox Studio.

1. Download and unzip the OS Open [Zoomstack Stylesheets](https://github.com/OrdnanceSurvey/OS-Open-Zoomstack-Stylesheets/archive/master.zip) folder. You can also [view the stylesheets](https://github.com/OrdnanceSurvey/OS-Open-Zoomstack-Stylesheets) on GitHub.
2. Copy the Map ID for your new Tileset by doing the following:
   * In Mapbox Studio, click on the *Tilesets* tab in the top right corner.<br>

     <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FomgAtySCwxvVVADU4vt4%2F9.png?alt=media" alt="Tilesets tab menu"><figcaption><p>Mapbox studio toolbar</p></figcaption></figure>
3. Scroll down until you see your new Tileset and click on the *Menu* button.<br>

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2F2dd0hVLQtEcr7vs4k8s5%2F10.png?alt=media" alt="Open zoomstack data shown in your menu"><figcaption><p>Uploaded Open zoomstack data</p></figcaption></figure>
4. Click on the clipboard icon to copy the Map ID.<br>

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FUj82kUE4ONQJ6DKpZx26%2F11.png?alt=media" alt="Map ID shown in the menu"><figcaption><p>Map ID data shown in the dropdown menu</p></figcaption></figure>
5. Open the folder of stylesheets that you downloaded in step 1 and navigate to *Vector Tiles → Mapbox GL*

*Styles* where you'll find four styles (Road, Outdoor, Light and Night).

1. Choose the style that you want to use and open the .json file (e.g. *Outdoor.json*) in a text editor.
2. Find this block of code near the top of the file (line 46) and paste your Map ID where it says ADD-SOURCE- URL-HERE: <br>

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FXmJC1JTlbsO4VkH6zssB%2F12.png?alt=media" alt="Screenshot of the Map ID composite attribute"><figcaption><p>Vector .json file</p></figcaption></figure>
3. Save the .json file.
4. Go back to Mapbox Studio and click on the *Styles* tab.

![Tilesets menu tile](https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2F2KytCOVk6VEovEG9Aa6U%2F13.png?alt=media)

5. Click on the *New style* button.

![New style button](https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FwctDNvkc7AatVs1J8g1P%2F14.png?alt=media)

6. ![Upload button screenshot](https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2F3x968Dni1tTDcbbn0YjA%2F15.png?alt=media)Click on the *Upload* button.
7. Navigate to your newly saved style.json file (e.g. OS Outdoor.json) and click *Open*. The style will then load up in the Mapbox Studio style editor.

* This is an example of what your map will look like if you chose the Outdoor style.<br>

  <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FE0BxGqFhUDMSDfjUholH%2F16.jpeg?alt=media" alt="A screenshot of the outdoor map style showing an area of roads, rivers, and built up areas"><figcaption><p>Outdoor map style</p></figcaption></figure>

You may notice at this point that the symbols for Airports and Railway Stations aren’t appearing, so now we need to add them to our new map.

1. Open the folder of stylesheets that you downloaded in step 1 and navigate to *Vector Tiles → Mapbox GL Styles* where you'll find a folder called *os-open-zoomstack-symbols*.
2. Open this folder, then drag and drop the 7 SVG files into Mapbox Studio (directly into your browser window).
3. Click *Confirm* on the *Upload images* dialogue box.<br>

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2Fxh7lIeomiGs9PoBc9Glq%2F17.png?alt=media" alt=""><figcaption><p>Upload images dialog box</p></figcaption></figure>
4. Mapbox Studio will recognise the images and you should now see Airport and Railway Station symbols.

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FrxIYX0CPcY4X3yO38ETI%2F18.jpeg?alt=media" alt="Mapbox data styled"><figcaption><p>Map image showing airport and railway symbols for London Heathrow Airport</p></figcaption></figure>

From this point on you can customise the content and style of your map (for example, you can turn layers on/off, delete them from your map, add new ones and change any of the style elements). You can learn more about how to use the Mapbox Studio style editor in this [manual.](https://www.mapbox.com/help/studio-manual-styles/)

Once you are happy with your map, click *Publish* in the top right corner and your map is ready to use. For more detailed information, take a look at [Mapbox Studio tutorials.](https://www.mapbox.com/help/tutorials/)

</details>

<details>

<summary>Cadcorp SIS Desktop 9</summary>

These instructions are based on Cadcorp SIS Desktop 9, released in November 2018.

1. Download the [Vector Tiles (MBTiles),](https://www.ordnancesurvey.co.uk/opendatadownload/products.html#ZMSTCK) and the accompanying [Mapbox GL Styles.](https://github.com/OrdnanceSurvey/OS-Open-Zoomstack-Stylesheets/tree/master/Vector%20Tiles/Mapbox%20GL%20Styles) You will need the style files from the Mapbox GL Styles folder and the sprites.json and sprites.png files, from the *sprites* sub-folder.
2. Rename one of the downloaded Mapbox GL Style files to *style.json* and place it, and the sprites.json and sprites.png files, alongside the downloaded MBTiles file (OS\_Open\_Zoomstack.mbtiles).
3. Open Cadcorp SIS Desktop.
4. The easiest way to load the data is to simply drag-and-drop the MBTiles file into Cadcorp SIS Desktop.
5. Because the tiles use the *WGS 84 Pseudo-Mercator* coordinate reference system the default extents are much bigger than GB, so you'll have to zoom in.

* Example view of Cambridge, using the Light style:<br>

  <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FPeEUtL44o2BmCDEFI6sH%2F19.jpeg?alt=media" alt="Example view of Cambridge using the light style in Cadcorp SIS Desktop 9"><figcaption><p>Cadcorp SIS Dektop 9 with a map of Cambridge in the main view </p></figcaption></figure>

</details>

<details>

<summary>QGIS</summary>

These instructions are based on QGIS 3.4 – a Long Term Release version.

1. Download the [Vector Tiles (MBTiles).](https://www.ordnancesurvey.co.uk/opendatadownload/products.html#ZMSTCK)
2. In QGIS, install the Vector Tile Reader Plugin.

Some versions of QGIS has a *Vector Tiles Reader* plugin that allows you to read Vector Tiles from a server, directory or local MBTiles file. Install the plugin as follows:

* Load QGIS desktop.
* From the top menu, click *Plugins* and then

![Manage and install plugins in the Plugins menu](https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2Fu0qi5OGswHsIlYVj1meJ%2F20.png?alt=media)

*Manage and Install Plugins*…

* In the dialogue box, search for *Vector Tiles Reader*, select it and click *Install plugin*.<br>

  <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FHXMyXYtZmNqcYIrmV6DZ%2Fimage.png?alt=media&#x26;token=4dc0b62b-3085-421b-9fed-0f1b37864122" alt=""><figcaption><p>Vector Tiles reader plugin shown in the plugin dialog</p></figcaption></figure>

3. This section shows you how to load Vector Tiles in QGIS.

* After you’ve installed the Vector Tiles Reader plugin, go to the top menu, click *Vector → Vector Tiles Reader → Add Vector Tiles Layer…*<br>

  <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FKjhZe4MBR66lEYIBlgDh%2Fimage.png?alt=media&#x26;token=cefff586-060d-41ca-abf8-9dc47109d5c6" alt="Add Vector Tiles Layer menu shown as an option in the Vector Menu under Vector Tiles Reader"><figcaption><p>Add Vectror Tiles Layer in the Vector Tiles Reader menu</p></figcaption></figure>
* In the dialogue box, select the *MBTiles* tab and then click *Browse*.<br>

  <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FTDAj1ckM9QCFOiiicrRE%2Fimage.png?alt=media&#x26;token=457e5e13-843b-49e7-8847-fd8a0fddda3c" alt=""><figcaption><p>Add MBTiles file tab in the Add Layer dialog</p></figcaption></figure>
* Navigate to your data, *OS\_Open\_Zoomstack.mbtiles*, and click *Open*.
* Then hold the CTRL key and select all the layers, select *Base map defaults* and click *Add*.\ <br>

  <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2Fop7Dy7RCKtGekPNq0SM5%2Fimage.png?alt=media&#x26;token=bfcf3f83-a522-4239-9d4e-8fe573d2b3de" alt="Window allowing the user to add MB Tiles Layers to a vector map"><figcaption><p>Add Layer(s) from a Vector Tile Source window</p></figcaption></figure>

  <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2Fd3RINtxMoWSSf0XYlCxz%2Fimage.png?alt=media&#x26;token=08c99604-44a5-43dd-b47f-21af18968c6c" alt="Add layer button highlighted in the dialog"><figcaption><p>Add layer button</p></figcaption></figure>

The data will then appear in your Layers Panel and render in your map window. This plugin is new, and you may find it a little slow - it helps the performance if you zoom in to street level as this will limit the number of features in your map window.

4. In the Layers Panel, drag and drop the layers into the following order as this is the order in which QGIS will draw them:<br>

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FN9O9R9faAl1r50vxWR0E%2Fimage.png?alt=media&#x26;token=84927433-0b5a-400b-ac55-e413531b8005" alt="Layers panel showing the available layers for OS Open Zoomstack data"><figcaption><p>Layers panel showing the available layers for OS Open Zoomstack data</p></figcaption></figure>

You'll find more [information and help with the plugin,](https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin/wiki/Help) on GitHub.

</details>

## Host your own Vector Tiles

There are many choices of tools and resources for hosting and serving your own Vector Tiles. An updated list of resources for working with Vector Tiles is available on the mapbox GitHub repository. A list of [resources for working with MBTiles specifically is available under the mapbox mbtiles-spec repository](https://github.com/mapbox/mbtiles-spec/wiki/Implementations).

Here is a [list of the available options](https://github.com/mapbox/awesome-vector-tiles/blob/master/README.md) for Vector Tiles and [some more here](https://github.com/mapbox/mbtiles-spec/wiki/Implementations) relating specifically to MBTiles.

If you want to export the MBTiles file to a directory of files, then you can use [Tippecanoe](https://github.com/felt/tippecanoe) or [MBUtil](https://github.com/mapbox/mbutil).&#x20;

### Using OS Styles on Vector Tiles You Created <a href="#id-2.7-using-os-styles-on-vector-tiles-you" id="id-2.7-using-os-styles-on-vector-tiles-you"></a>

It is possible to use OS styles on Vector Tiles you’ve created. Follow the steps below to do this.

1. You will need to [download](https://github.com/OrdnanceSurvey/OS-Open-Zoomstack-Stylesheets/archive/master.zip) the folder of stylesheets. You can also [view the stylesheets](https://github.com/OrdnanceSurvey/OS-Open-Zoomstack-Stylesheets) on GitHub.
2. Once you’ve downloaded and unzipped the folder of stylesheets, navigate to *Vector Tiles → Mapbox GL Styles* where you will find four styles.

Choose the style that you want to use and open the .json file (e.g. *OS Outdoor.json*) in a text editor.

3. Find this chunk of code near the top of the file and paste your data source where it says ADD-SOURCE- URL-HERE:<br>

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2FRCvBQV4l0FsqCXj0hamP%2Fimage.png?alt=media&#x26;token=0db9925e-0ce0-42c3-a36d-05891089c12f" alt="Source composite URL snippet within a Vector source .json file" width="500"><figcaption><p>Vector source .json file</p></figcaption></figure>

You can find more information on the different source types [here.](https://www.mapbox.com/mapbox-gl-js/style-spec/#sources)

4. Save the .json file.

This style is now ready to use. If you want to customise the style, then [Maputnik](https://maputnik.github.io/editor/) is a good open source map editor for this job.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.os.uk/os-downloads/products/maps-and-imagery-portfolio/os-open-zoomstack/os-open-zoomstack-getting-started-guide/zoomstack-vector-tiles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
