Use maps.wien.gv.at's Vector Basemap with QGIS 3.8

[Update September 2021]

As of QGIS 3.16 this works out of the box and there is now official documentation on how to use basemap.at's Vector maps.

The original post follows.

Prerequisites

Prepare a TileJSON file

Vector Tiles Reader unfortunately doesn't allow to directly use the output of ArcGIS, with which the vector basemaps are exported. We have to create our own TileJSON file from the data as outlined in this issue.

First, let's install jq, a command line tool for JSON processing which we use later to generate the TileJSON file.

apt-get update && apt-get install jq
9.1s

Then get the original ESRI root.json from maps.wien.gv.at, which contains the layer information we need to put in the TileJSON.

curl -O https://maps.wien.gv.at/basemapv/bmapv/3857/resources/styles/root.json
0.9s

Vector Tiles Reader only supports ASCII names in layer names, so let's make the file ASCII compatible by removing umlauts.

sed -e s/ä/ae/g -e s/ö/oe/g -e s/ü/ue/g -e s/Ä/AE/g -e s/Ö/OE/g -e s/Ü/UE/g -e s/ß/ss/g root.json > cleaned-root.json
0.2s

Now we need to generate a basic TileJSON which Vector Tiles Reader can handle. We use this as the template, already providing the URL template for the vector tile files.

{
	"maxzoom": 23,
	"minzoom": 0,
	"tiles": [
    "https://maps.wien.gv.at/basemapv/bmapv/3857/tile/{z}/{y}/{x}.pbf"
	]
}
JSON

Finally, we copy over the layers attribute of the root.json into our template as vector_layers using jq, storing the resulting file.

jq -s "(.[0].vector_layers = .[1].layers)[0]" tilejson-template.json cleaned-root.json > results/tilejson.json
0.2s

Adding the Basemap

We now can use that generated tilejson.json file directly in QGIS using these steps

In QGIS, use the menu Vector > Vector Tiles Reader > Add Vector Tiles Layer...

In the Server Tab, click New

As the TileJSON URL we can paste the link directly from the jq result from above.

Continue with Save, wait for the layers to show up in the list and finish and then click Add.

This looks very rough, but should be a good starting point.

Runtimes (1)