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:

_images/zoomstack_example.png

This guide shows you how to use Zoomstack in Mappin.

Getting the data

First you’ll need to download the data from here.

  1. Download the data in GeoPackage format
  2. Extract the geopackage file to C:\

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.

  1. Open an OSGeo4W shell

  2. 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.

  1. Download the OS published styles from here using the clone-or-download button.

  2. Extract the zip file

  3. 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

  4. For each of the loaded layers, double-click them and load their associated stylesheet:

    _images/load_style.png

    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.

  5. Ensure all the layers sit within a new group called zoomstack:

    _images/zoomstack_in_group.png
  6. Disable QGIS’ Allow truncated labels on edges of map option for the following layers:

    • names
    • airports
    • railway_stations
    • roads_national
    • roads_regional
    • roads_local

    This will ensure that no truncated / cropped labels will be seen when published.

    _images/disable_allow_truncated.png
  7. 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.

  1. Open your project in Mappin’s admin interface

  2. Go to the Layers section and click ADD NEW LAYER

  3. Set your settings similar to these:

    _images/zoomstack_layer_settings.png

    The Name (WMS) option should match the name of the group containing the zoomstack layers in QGIS.

  4. Enable caching for the layer

  5. Click SAVE CHANGES

  6. 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.