From b994c64d6b57eaf48bf43360405d4988518c2ec1 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 26 Jun 2023 17:19:36 +0200 Subject: [PATCH] Cyclosm: add contours in db --- README.md | 4 +++- run.sh | 15 +++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 288428e..bce1fbf 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,9 @@ Also, rename them as in the zip file, so simplified-land-polygons-complete-3857. ##### Contour lines -http://opendata.champs-libres.be/beautiful-contour-belgium.zip +Download the geopackage from http://opendata.champs-libres.be/beautiful-contour-belgium.zip, convert it to shp and place it into the pbf/shp folder under the name "contours.shp". It will be mounted as written in the `docker-compose.yml` file. + +The shp is imported using `shp2pgsql` in the import step, assuming EPSG:31370 as the input shp CRS. #### Hillshade diff --git a/run.sh b/run.sh index 449fbe1..b1b5b88 100755 --- a/run.sh +++ b/run.sh @@ -32,7 +32,12 @@ function compileStyle() { sed -i 's/*extents84/*extents/g' ./cyclosm-cartocss-style/project.mml sed -i 's,dem/shade.vrt,/data/hillshade.tif,g' ./cyclosm-cartocss-style/project.mml sed -z 's/status: off\n- id: contours100/status: on\n- id: contours100/' -i ./cyclosm-cartocss-style/project.mml - + # change contours + sed -z 's/status: off\n- id: contours50/status: on\n- id: contours50/' -i ./cyclosm-cartocss-style/project.mml + sed -z 's/status: off\n- id: contours20/status: on\n- id: contours20/' -i ./cyclosm-cartocss-style/project.mml + sed -z 's/status: off\n- id: contours10/status: on\n- id: contours10/' -i ./cyclosm-cartocss-style/project.mml + sed -z 's/status: off\n- id: waterway_low/status: on\n- id: waterway_low/' -i ./cyclosm-cartocss-style/project.mml + sed -i 's/dbname: "contours"/dbname: "gis"/g' ./cyclosm-cartocss-style/project.mml # carto build carto cyclosm-cartocss-style/project.mml > mapnik.xml } @@ -137,11 +142,9 @@ if [ "$1" == "import" ]; then # Create cyclosm special views sudo -u renderer psql -d gis -f "/data/style/cyclosm-cartocss-style/views.sql" - #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 + # Import contour files + shp2pgsql -s 31370:3857 -c -g geometry -I /data/shp/contours.shp public.contours | sudo -u renderer psql -d gis + sudo -u renderer psql -d gis -c "ALTER TABLE public.contours RENAME COLUMN elev TO height;" # Register that data has changed for mod_tile caching purposes sudo -u renderer touch /data/database/planet-import-complete