add scripts for osmbe and run it

This commit is contained in:
nobohan 2024-02-25 18:27:31 +01:00
parent fbb68e8c4f
commit 9d1b824e0f

11
run.sh
View File

@ -15,11 +15,12 @@ function setPostgresPassword() {
function compileStyle() { function compileStyle() {
cd /data/style/ cd /data/style/
git clone --single-branch --branch update-2024 https://github.com/nobohan/openstreetmap-carto-be --depth 1 git clone --single-branch --branch update-2024 https://github.com/nobohan/openstreetmap-carto-be --depth 1
# TODO check if changes are needed as in cyclosm and oam
mkdir /data/style/patterns/ mkdir /data/style/patterns/
mv /data/style/openstreetmap-carto-be/patterns/* /data/style/patterns/ mv /data/style/openstreetmap-carto-be/patterns/* /data/style/patterns/
mkdir /data/style/symbols/ mkdir /data/style/symbols/
mv /data/style/openstreetmap-carto-be/symbols/* /data/style/symbols/ mv /data/style/openstreetmap-carto-be/symbols/* /data/style/symbols/
mkdir /data/style/scripts/
mv /data/style/openstreetmap-carto-be/scripts/* /data/style/scripts/
carto openstreetmap-carto-be/project-fr.mml > mapnik.xml carto openstreetmap-carto-be/project-fr.mml > mapnik.xml
} }
@ -103,7 +104,7 @@ if [ "$1" == "import" ]; then
OSM2PGSQL_EXTRA_ARGS="${OSM2PGSQL_EXTRA_ARGS:-} --flat-nodes /data/database/flat_nodes.bin" OSM2PGSQL_EXTRA_ARGS="${OSM2PGSQL_EXTRA_ARGS:-} --flat-nodes /data/database/flat_nodes.bin"
fi fi
# Import data TODO check the path and other options # Import data
sudo -u renderer osm2pgsql -d gis --create --hstore -G -S openstreetmap-carto-be/openstreetmap-carto.style --tag-transform-script openstreetmap-carto-be/openstreetmap-carto.lua \ sudo -u renderer osm2pgsql -d gis --create --hstore -G -S openstreetmap-carto-be/openstreetmap-carto.style --tag-transform-script openstreetmap-carto-be/openstreetmap-carto.lua \
/data/region.osm.pbf \ /data/region.osm.pbf \
${OSM2PGSQL_EXTRA_ARGS:-} \ ${OSM2PGSQL_EXTRA_ARGS:-} \
@ -120,6 +121,12 @@ if [ "$1" == "import" ]; then
sudo -u postgres psql -d gis -f /data/style/${NAME_SQL:-indexes.sql} sudo -u postgres psql -d gis -f /data/style/${NAME_SQL:-indexes.sql}
fi 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
# Register that data has changed for mod_tile caching purposes # Register that data has changed for mod_tile caching purposes
sudo -u renderer touch /data/database/planet-import-complete sudo -u renderer touch /data/database/planet-import-complete