Offline mapping guide
- Docker
- tilemaker
- tileserver-gl
- Any browser
- QGIS version 3.8 or higher (optional)
First of all you need to install Docker. To install use official Docker website or my cheatsheet
After successful installation pull following images to use them offline:
ghcr.io/systemed/tilemaker:mastermaptiler/tileserver-gl:latest
To pull Docker image use docker pull <image_name>
Note
If you are using linux: sudo docker pull <image_name>
Tip
Downloading Docker images as .tar files: docker save -o <path for generated tar file> <image name>
To load Docker image from .tar file run docker load --input <image_name>.tar
Download this repository!
Download .osm.pbf file of country or region you want from Geofabrik
Now it is obligatory needed to convert .osm.pbf to .mbtiles using tilemaker. Just move to folder, where config-openmaptiles.json and process-openmaptiles.lua are located, copy your .osm.pbf file there and simply run:
docker run -it --rm -v "<Path to folder you in>:/data" ghcr.io/systemed/tilemaker:master /data/<name>.osm.pbf --output /data/<output_name>.mbtiles --config /data/config-openmaptiles.json --process /data/process-openmaptiles.lua
Merging
Just add --merge and the end of the command above. Note: output .mbtiles file must already exist for a successful merge.
Note
It is recommended to download the smallest object possible and then merging it up to something bigger (i.e. from independent regions to country) if you have lower than 16GB of RAM.
16GB of RAM will easily process .osm.pbf files up to ~1.5GB
- Move your
.mbtilesfile totileserverfolder - Open
config.jsonand change*.mbtilesto your<output_name>.mbtilesfile name. - Move to
tileserverfolder and then executedocker run -it --rm -v "<Path to folder you in>:/data" -p 8080:8080 maptiler/tileserver-gl:latest - Open web-browser and enter
http://localhost:8080link - Select "Viewer"
- Zoom out until you see something on a map.
- Enjoy!
Note
If any issuses seen (something not loading on different levels) please clear your browser cache
- Install QGIS version 3.8 or higher
- Download simplifed water polygons (Mercator)
- Open QGIS. Select
ToolboxinProcessingtab - Select
Raster toolsand clickGenerating XYZ (mbtiles) - In opened menu select your
.shpfile, min zoom level0and max zoom level10. Change background color toBlueand selectPNGformat. - Start processing. You will get
.mbtilesfile ~1GB size. Rename it toworldocean.mbtiles - Add
"worldocean": { "mbtiles": "water-png.mbtiles" }tov3inconfig.json - Add
"worldocean":{ "type": "raster", "url": "mbtiles://{worldocean}" }tosourcesinstyle-local.json - Add
{ "id": "ocean-fill", "type": "raster", "source": "worldocean", "source-layer": "water-png", "layout": { "visibility": "visible" } },tolayersinstyle-local.json - Watch step #3
All rights belongs to it authors.
