This is the notes, scripts, and tools I used to build the maps for the virtual running challenges.
Use scripts/build-mapnik.sh
to build mapnik
(version 4.0 from HEAD) and python-mapnik
.
brew install postgresql@14 postgis osm2pgsql
pip3 install nik4
git clone https://github.com/gravitystorm/openstreetmap-carto.git
git clone https://github.com/mapnik/mapnik.git
git clone https://github.com/mapnik/python-mapnik.git
Download data from Geofabrik - the route readme files for details.
To start the PostgresQL database:
brew services run postgresql@14
To prepare the database (you might want to delete the database first?):
createdb gis
psql -d gis -c 'CREATE EXTENSION postgis; CREATE EXTENSION hstore;'
To load the data:
cd openstreetmap-carto
osm2pgsql -G --hstore --style openstreetmap-carto.style --tag-transform-script openstreetmap-carto.lua -d gis ../data/us-latest.osm.pbf
./scripts/get-external-data.py
Build the mapnik.xml
:
npm install -g carto
cd openstreetmap-carto
carto project.mml > mapnik.xml
You need to use Font Book.app
to check if the fonts are installed. If not:
cd openstreetmap-carto
./scripts/get-fonts.sh
Now use the Finder to drag all the font files to Font Book.
- PostgresQL - database
- PostGIS - geospatial extensions to the database
- osm2pgsql - load OSM data into the database
- Nik4 - render data to image