adapt carto mapnik xml compilation and osm2pgsql import for cyclosm

This commit is contained in:
nobohan 2023-06-25 10:49:01 +02:00
parent c2ce0cdd36
commit 6276d18671

32
run.sh
View File

@ -29,22 +29,17 @@ fi
set -x
# if there is no custom style mounted, then use osm-carto
if [ ! "$(ls -A /data/style/)" ]; then
mv /home/renderer/src/openstreetmap-carto-backup/* /data/style/
fi
# carto build
if [ ! -f /data/style/mapnik.xml ]; then
cd /data/style/
carto ${NAME_MML:-project.mml} > mapnik.xml
fi
if [ "$1" == "terminal" ]; then
bash
fi
if [ "$1" == "import" ]; then
cd /data/style/
git clone --single-branch --branch v0.6 https://github.com/cyclosm/cyclosm-cartocss-style.git --depth 1
# carto build
carto cyclosm-cartocss-style/project.mml > mapnik.xml
# Ensure that database directory is in right state
mkdir -p /data/database/postgres/
chown renderer: /data/database/
@ -101,9 +96,6 @@ if [ "$1" == "import" ]; then
# Import data
sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore \
--tag-transform-script /data/style/${NAME_LUA:-openstreetmap-carto.lua} \
--number-processes ${THREADS:-4} \
-S /data/style/${NAME_STYLE:-openstreetmap-carto.style} \
/data/region.osm.pbf \
${OSM2PGSQL_EXTRA_ARGS:-} \
;
@ -119,11 +111,11 @@ if [ "$1" == "import" ]; then
sudo -u postgres psql -d gis -f /data/style/${NAME_SQL:-indexes.sql}
fi
#Import external data
chown -R renderer: /home/renderer/src/ /data/style/
if [ -f /data/style/scripts/get-external-data.py ] && [ -f /data/style/external-data.yml ]; then
sudo -E -u renderer python3 /data/style/scripts/get-external-data.py -c /data/style/external-data.yml -D /data/style/data
fi
#Import external data TODO cyclosm: change this
# chown -R renderer: /home/renderer/src/ /data/style/
# if [ -f /data/style/scripts/get-external-data.py ] && [ -f /data/style/external-data.yml ]; then
# sudo -E -u renderer python3 /data/style/scripts/get-external-data.py -c /data/style/external-data.yml -D /data/style/data
# fi
# Register that data has changed for mod_tile caching purposes
sudo -u renderer touch /data/database/planet-import-complete
@ -206,7 +198,7 @@ if [ "$1" == "generate_tiles" ]; then
sudo -u renderer renderd -c /etc/renderd.conf
cat /data/tiles/default/tiles.list | render_list --map default
cat /data/tiles/cyclosm/tiles.list | render_list --map cyclosm
fi
echo "invalid command"