Using Ordnance Survey Zoomstack¶
Ordnance Survey (OS) provide a great dataset called Zoomstack. The dataset provides vector maps for the whole of the UK and comes with an attractive style:
This guide shows you how to use Zoomstack in Mappin.
Getting the data¶
First you’ll need to download the data from here.
- Download the data in GeoPackage format
- Extract the geopackage file to
Loading into PostGIS¶
The next task is to load the data into PostGIS. For this we’ll use the ogr2ogr.exe command-line utility. This ships with QGIS and is best accessed from the OSGeo4W shell.
Open an OSGeo4W shell
Run these commands:
cd C:\tmp ogr2ogr -f PostgreSQL "PG:host=you-postgis.cloudmappin.com port=5432 user=postgres password=your-password dbname=postgres" -lco SCHEMA=zs OS_Open_Zoomstack.gpkg
You’ll need to update the values for host, port, password and SCHEMA accordingly.
It’s recommended to upload the data into a schema called zs as shown above.
This command will take a while to complete.
Styling in a QGIS project¶
Now the data has been imported we want to load it in QGIS and apply styles.
Download the OS published styles from here using the button.
Extract the zip file
Load the Zoomstack layers in QGIS in the order shown in this file in the extracted stylesheets:
OS-Open-Zoomstack-Stylesheets-masterGeoPackageQGIS Stylesheets (QML)Layer Order.PNG
For each of the loaded layers, double-click them and load their associated stylesheet:
Stylesheets can be found under OS-Open-Zoomstack-Stylesheets-masterGeoPackageQGIS Stylesheets (QML) and are named after the layers. A popular style is the Outdoor style.
Don’t worry for the moment if you see question marks indicating missing SVG markers - these will be present when the map is displayed through Mappin.
Ensure all the layers sit within a new group called zoomstack:
Disable QGIS’ Allow truncated labels on edges of map option for the following layers:
This will ensure that no truncated / cropped labels will be seen when published.
Save the QGIS project
At this point you can either upload the project file (as a .qgs file) to Mappin, or you can export the zoomstack group as a QGIS Layer Definition File which can be used to quickly add the zoomstack background maps group to other projects.
Publishing in Mappin¶
After we have uploaded a QGIS project to Mappin which contains the zoomstack group of layers we defined above, we can publish it.
If we used the LOAD LAYERS button in the Layers section of the Mappin admin interface, Mappin would prompt us to load / publish each of the zoomstack component layers individually. Instead, we will use the ADD NEW LAYER button to manually publish the whole group as a single layer.
Open your project in Mappin’s admin interface
Go to the Layers section and click ADD NEW LAYER
Set your settings similar to these:
The Name (WMS) option should match the name of the group containing the zoomstack layers in QGIS.
Enable caching for the layer
Click SAVE CHANGES
In the layer’s cache settings, set Meta Buffer Size to 19 and Meta Tile Size to 0
You should now have a published zoomstack background map with caching enabled. The layer’s drawing performance will increase as its tiles are cached.
Using with other background map layers¶
A common use case is to use Zoomstack with another, more detailed map layer (e.g. OS MasterMap). This section describes best practice for using these layers together.
When using multiple data sources to provide a single, seamless background map layer, it’s recommended to add the various map sources to a Mappin group. If the group’s Collapsible setting is cleared, the maps in the group will appear as a single layer to the user.
If you wish to use zoom-dependant rendering to control which layers are drawn at which zoom levels, be careful when editing the zoom-dependant rendering settings for the zoomstack layers. Zoomstack is a national dataset but its styles and labelling rules (included with the default styles provided by OS) are set to only display features at an appropriate scale. This is achieved using zoom-dependant rendering settings and ensures the layers perform well at all scales. Care should be taken to not accidentally change the settings in a way which means layers such as local roads are drawn at the national level. This will severely impact drawing performance and may cause other problems.