Skip to content

titemov/Offline-mapping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Offline-mapping

Offline mapping guide

Wien

Guide

Software

  1. Docker
  2. tilemaker
  3. tileserver-gl
  4. Any browser
  5. QGIS version 3.8 or higher (optional)

Step #1

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:master
  • maptiler/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

Step #2

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

Step #3

  • Move your .mbtiles file to tileserver folder
  • Open config.json and change *.mbtiles to your <output_name>.mbtiles file name.
  • Move to tileserver folder and then execute docker run -it --rm -v "<Path to folder you in>:/data" -p 8080:8080 maptiler/tileserver-gl:latest
  • Open web-browser and enter http://localhost:8080 link
  • 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

Optional step: setting up world ocean

  • Install QGIS version 3.8 or higher
  • Download simplifed water polygons (Mercator)
  • Open QGIS. Select Toolbox in Processing tab
  • Select Raster tools and click Generating XYZ (mbtiles)
  • In opened menu select your .shp file, min zoom level 0 and max zoom level 10. Change background color to Blue and select PNG format.
  • Start processing. You will get .mbtiles file ~1GB size. Rename it to worldocean.mbtiles
  • Add "worldocean": { "mbtiles": "water-png.mbtiles" } to v3 in config.json
  • Add "worldocean":{ "type": "raster", "url": "mbtiles://{worldocean}" } to sources in style-local.json
  • Add { "id": "ocean-fill", "type": "raster", "source": "worldocean", "source-layer": "water-png", "layout": { "visibility": "visible" } }, to layers in style-local.json
  • Watch step #3

References:

  1. OpenStreetWiki
  2. Tilemaker (Licence)
  3. tileserver-gl (Licence)
  4. OSM-Liberty (Licence)

All rights belongs to it authors.

About

Offline mapping guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages