Austria's government provides a lot of open data on its data.gv.at- Open Data Österreich portal. One of the treasures that can be found there are offline vector tiles for basemap.at Verwaltungsgrundkarte Österreich.
This readme will guide you through all steps required in order to host basemap.at vector tiles on your private server.
Since the tiles provided are contained in an ESRI Vector Tile Package (VTPK) and this container format cannot be served by open source tile servers we have written OpenVTPK in order to repackage the tiles into an MBTiles container.
Please read our detailed instructions on how to use OpenVTPK. After you have repackaged the vector tiles continue here.
The metadata has been updated and got a new timestamp. After a short analysis we could not find any improvement regarding the broken root.json
style.
It's worth noting that the basemap.at Offline vector Tiles are still labeled with the Beta tag.
We will assume that you followed the instructions provided by OpenVTPK and have your expanded basemap.at VTPK folder ready to use.
Since Docker is our best friend we are not going into a complicated setup procedure. We will use Klokan Technologies TileServer GL to serve the tiles and the corresponding styles.
The provided VTPK container also includes all resources required to style the vector tiles:
- fonts
- sprites
- styles
All the resources required are located in the p12/resources
subfolder of your expanded VTPK container (see description above).
Let's create a folder that will become the root folder for TileServer GL (i.e. basemap
) and copy the folders fonts
, styles
and sprites
from the p12/resources
folder. We do not need the infos
folder.
Create an additional tiles
folder and put the mbtiles file you want to serve here. Please follow the instructions above in order to repackage the basemap.at VTPK container which we will use in this example.
After that your folder structure should look like this:
basemap
fonts
Arial Regular
Arial Bold
Corbel Regular
Corbel Bold
Corbel Italic
Corbel Bold Italic
Tahoma Regular
sprites
sprite.png
sprite.json
sprite@2x.png
sprite@2x.json
styles
root.json
tiles
Basemap_20190617.mbtiles
Unfortunately the root.json style shipped with the current version of basemap.at (as of October 28th 2019) contains a lot of errors:
mbgl: { class: 'ParseStyle',
severity: 'WARNING',
text: 'duplicate layer id STRASSENNETZ/BRUECKE/GIP_OUTSIDE_BAUWERK_L_BRÜCKE/112111/1' }
mbgl: { class: 'ParseStyle',
severity: 'WARNING',
text: 'duplicate layer id STRASSENNETZ/BRUECKE/GIP_OUTSIDE_BAUWERK_L_BRÜCKE/112111/0' }
mbgl: { class: 'ParseStyle',
severity: 'WARNING',
text: 'function value must specify stops' }
mbgl: { class: 'ParseStyle',
severity: 'WARNING',
text: 'function value must specify stops' }
mbgl: { class: 'ParseStyle',
severity: 'WARNING',
text: 'function value must specify stops' }
mbgl: { class: 'ParseStyle',
severity: 'WARNING',
text: 'function value must specify stops' }
(... many more lines ...)
Please find a corrected version of the style file in our repository. The changes reflect
- renaming a duplicate style layer
STRASSENNETZ/BRUECKE/GIP_OUTSIDE_BAUWERK_L_BRÜCKE/112111/0
- renaming a duplicate layer
STRASSENNETZ/BRUECKE/GIP_OUTSIDE_BAUWERK_L_BRÜCKE/112111/1
- fixing
by adding
mbgl: { class: 'ParseStyle', severity: 'WARNING', text: 'function value must specify stops' }
"stops": [ [{"zoom": 17, "value": 0}, 0], [{"zoom": 18, "value": 0}, 0] ]
This file also contains modifications required to meet all path values we will use for the tile server:
"sprite": "/sprite",
"glyphs": "/{fontstack}/{range}.pbf",
"sources": {
"esri": {
"type": "vector",
"url": "/data/basemap.at.json"
}
}
Now we are ready to create a configuration file (config.js) for TileServer GL:
{
"options": {
"paths": {
"root": "",
"fonts": "fonts",
"sprites": "sprites",
"styles": "styles",
"mbtiles": "tiles"
}
},
"styles": {
"basemap": {
"style": "root.json",
"serve_data": true
}
},
"data": {
"basemap.at": {
"mbtiles": "Basemap_20190617.mbtiles"
}
},
"settings": {
"serve": {
"vector": true,
"raster": true,
"services": true,
"static": true
},
"raster": {
"format": "PNG_256",
"hidpi": 2,
"maxsize": 2048
}
}
}
Open your console, change to the basemap folder we created and start TileServer GL:
docker run --rm -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl
Starting Xvfb on display 99
xdpyinfo: unable to open display ":99".
xdpyinfo: unable to open display ":99".
Starting tileserver-gl v2.6.0
Using specified config file from config.json
Starting server
Listening at http://[::]:80/
Startup complete
Open your favorite browser and navigate to http://localhost:8080 (we have mapped TCP port 80 from within the docker container to port 8080 on our local machine):
Click on the Vector link on the dashboard in order to view your styled vector tiles. Depending on the correctness of the metadata in the VTPK file and the style rules (especially minzoom
and maxzoom
) your viewpoint may be out of scope and you will only see a white page. Please change the zoom level and the coordinates in the browser url accordingly.
The result is beautiful and available offline: