Creating a custom style for OS NGD API – Tiles
Last updated
Was this helpful?
Last updated
Was this helpful?
This ‘how-to’ guide will show you how to create your own style for OS NGD API – Tiles which you can then use in web maps and GIS software.
To do this, we recommend using the open source visual editor, Maputnik.
Go to https://maputnik.github.io/ and click on Editor from the top menu.
We recommend starting with one of our existing styles as a basis for creating your own style; you can view the available styles from the endpoint. For example, https://api.os.uk/maps/vector/ngd/ota/v1/collections/ngd-base/styles/3857
In Maputnik:
Click Open.
Paste the style URL into the Load from URL box.
Click Load from URL.
Click Data Sources and delete any existing active sources.
Under Add New Source, enter the following details:
Source ID: ngd-base
Source Type: Vector (Tile URLs)
Tile URL: https://api.os.uk/maps/vector/ngd/ota/v1/collections/ngd-base/tiles/3857/{z}/{y}/{x}?key=INSERT_API_KEY_HERE
Scheme Type: xyz (Slippy map tilenames scheme)
Min Zoom: 6
Max Zoom: 19
Click Add Source.
The map should now appear in the map view.
Using the Layers panel on the left, or click on a feature on the map, select the layer you want to alter.
You can now use Paint properties in the editing panel on the left to alter the styling of these features.
There are many things you can change in Maputnik with regard to styling, including the opacity of layers, the style of features at different zoom levels, and what features appear at various zoom levels. It is also possible to filter the data based on an attribute value.