Resilience Theatre

Personal projects for resilience

User Tools

Site Tools


edgemap:planet_with_tilemaker

OSM planet

This page shows you how to create your own planet file from latest OSM data with Tilemaker. For resilience, you should prepare one dedicated high end laptop or desktop workstation for this task and stabilize your ability to create planet.pmtiles file for your deployments.

Check also protomaps project page, what is 'pmtiles' format and why it's great with maplibre-gl-js map framework. My plan is to sponsor protomaps as soon as I can.

With this approach your map production and availability is not dependent on Internet connectivity and you can have always full OSM planet for your spatial systems.

I've used Debian 12 on my main computer with AMD Ryzen 7 5800X and 32 GB RAM. Usually this process has been very disk, memory and CPU intensive but tilemaker has lowered that bar quite a bit. But be prepared to have good amount of memory and big swap (I have 64 GB swap for this task).

Edgemap screenshots

Some screenshots of freshly created pmtiles shown on Edgemap from OSM planet data.

Install tilemaker

Check dependencies from tilemaker github page before installing tilemaker. Bellow are my Debian 12 package installs.

sudo apt install libboost-all-dev lua5.4 sqlite3 shapelib rapidjson-dev liblua5.4-dev libsqlite3-dev \
libz-dev libshp-dev curl

Clone and compile tilemaker

git clone https://github.com/systemed/tilemaker.git
make

Create 50 GB swap file. This allowed me to complete tilemaker with 16 GB RAM on my laptop, which is generally way too little for task at hand - but was more like an experiment.

sudo dd if=/dev/zero of=~/newswap bs=1024 count=50000000
sudo chmod 0600 ~/newswap 
sudo mkswap ~/newswap 
sudo swapon ~/newswap

Get planet OSM

wget https://planet.osm.org/pbf/planet-latest.osm.pbf

It seems that Tilemaker project has included “convenience scripts to download coastline and landuse data”.

They work great and simplifies process, run them as:

./get-landcover.sh
./get-coastline.sh

You can export directories and files as bellow or use just them as tilemaker parameters.

:!: This part is verified to work even on 16 GB RAM equipped Dell laptop on July 2024

export PBF_FILE=[PATH]/planet-latest.osm.pbf
export OUTPUT_FILE=[PATH]/planet.pmtiles
# Create 'store_temp' directory first to fast SSD drive
export STORE_FILES=[PATH]/store_temp

# Run tilemaker:
./tilemaker --input $PBF_FILE --output $OUTPUT_FILE \
--config resources/config-openmaptiles.json \
--process resources/process-openmaptiles.lua \
--store $STORE_FILES \
--shard-stores --compact

Run time for this command varies based on your computer speed and memory. For me it took around 3 hours to complete on my desktop (AMD Ryzen 7 5800X + 32 GB RAM). Experimented this also with i5-7300U based Dell laptop with 16 GB RAM + 50 GB swap file and planet.pmtiles creation time was around 48 hours(!).

Result is planet.pmtiles file, which is around 70 GB currently (July 2024). You can use this file together with Edgemap and enjoy fully self produced and offline street level map of whole planet!

Remember to thank and attribute OpenSteetMap, protomaps and Tilemaker contributors!

edgemap/planet_with_tilemaker.txt · Last modified: 2024/08/04 04:36 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki