Last active
June 27, 2024 05:57
-
-
Save mikaelhg/2ec508b355398812fcb50d9da2d7603b to your computer and use it in GitHub Desktop.
Generate static, Helsinki only map tiles from OpenStreetMap data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bounding box from http://norbertrenner.de/osm/bbox.html | |
HELSINKI_BBOX=24.577,60.079,25.228,60.335 | |
# OpenStreetMap extract file from Geofabrik | |
wget https://download.geofabrik.de/europe/finland-latest.osm.pbf | |
# Cut the 500 MB Finland data file into a 34 MB Helsinki data file | |
# as this is much faster than using the import bbox. | |
osmconvert finland-latest.osm.pbf -b="$HELSINKI_BBOX" --out-pbf >helsinki.pbf | |
docker volume create openstreetmap-data | |
docker run --rm -it -e THREADS=8 \ | |
-v `pwd`/helsinki.pbf:/data.osm.pbf \ | |
-v openstreetmap-data:/var/lib/postgresql/12/main \ | |
overv/openstreetmap-tile-server import | |
# The result is a 1.7 GB PostgreSQL data directory. Consider putting the volume on /dev/shm instead. | |
docker volume create openstreetmap-data | |
docker run -it --rm --name=osm -p 80:80 -e THREADS=4 \ | |
-v openstreetmap-data:/var/lib/postgresql/12/main \ | |
-v openstreetmap-rendered-tiles:/var/lib/mod_tile \ | |
overv/openstreetmap-tile-server run | |
docker exec -it osm render_list -a -z 4 -Z 13 -n 4 -m ajt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A much better solution: https://gist.github.com/mikaelhg/edf65dfad43e240fb4c483587b5e7f93