- osm2pgsql 1.9.2+
- osm2pgsql themepark
- Python 3.10+
- PostgreSQL 10+
- PostGIS 3.3+
- Tilekiln 0.3.0+
- charites
- @basemaps/sprites
Install tilekiln into a Python virtualenv with
python3 -m venv venv
venv/bin/pip install tilekiln
Install charites with
npm install @unvt/charites @basemaps/sprites
Install themepark to somewhere on your system, e.g. $HOME/osm2pgsql-themepark
git clone https://github.com/osm2pgsql-dev/osm2pgsql-themepark.git $HOME/osm2pgsql-themepark
Set your LUA_PATH to include themepark, e.g.
export LUA_PATH="$HOME/osm2pgsql-themepark/lua/?.lua;;"
Data can be loaded to create tiles for Street Spirit, Shortbread, or both.
You need OpenStreetMap data loaded into a PostGIS database. These stylesheets expect a database generated with osm2pgsql using the flex backend with the supplied Lua scripts.
Start by creating a database and enabling PostGIS
sudo -u postgres createuser -s $USER
createdb spirit
psql -d spirit -c 'CREATE EXTENSION postgis;'
Grab some OpenStreetMap data. It's probably easiest to grab a PBF of OSM data from Geofabrik. Once you've done that, import with osm2pgsql:
osm2pgsql --output flex --style spirit.lua -d spirit ~/path/to/data.osm.pbf
If you are only creating Shortbread tiles, instead of --style spirit.lua
use --style shortbread.lua
Some features are rendered using preprocessed shapefiles.
To download them and import them into the database you can run the following script
scripts/get-external-data.py
The script downloads shapefiles, loads them into the database and sets up the tables for rendering. Additional script option documentation can be seen with scripts/get-external-data.py --help
.
Once tilekiln is installed, run it in development mode with
venv/bin/tilekiln dev --config spirit.yaml --source-dbname spirit
To create shortbread tiles, instead use --config shortbread.yaml
. If only creating shortbread tiles you do not need to serve sprites or view the style.
In another terminal window, run
node_modules/.bin/basemaps-sprites sprites && python3 serve.py
With tiles being served in one terminal session, run a local style server with
node_modules/.bin/charites serve style.yaml