Cyclosm: add contours in db

This commit is contained in:
nobohan 2023-06-26 17:19:36 +02:00
parent f5c2022e7f
commit b994c64d6b
2 changed files with 12 additions and 7 deletions

View File

@ -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

15
run.sh
View File

@ -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