From 2536b967eb4092b2128294b99a952c99902aa567 Mon Sep 17 00:00:00 2001 From: "Ruben L. Mendoza" Date: Thu, 12 Feb 2026 17:36:47 -0500 Subject: [PATCH 1/8] Update config and paths to deploy services with docker compose (#696) * Fix docker tiler volume for staging and production * Fix taginfo data processor image * Update readme * update * Update configs * Update deploy scripts * Update scripts * Display template * Remove tilerdb adn imposm from base * Add network tiler-db * Restart taginfo web after data has been proceed * Update overpass docker image --- hetzner/deploy.sh | 157 +++++-------------------- hetzner/osmcha/osmcha.base.yml | 14 ++- hetzner/osmcha/osmcha.production.yml | 10 +- hetzner/overpass/overpass.base.yml | 2 +- hetzner/start_all.sh | 20 +++- hetzner/taginfo/taginfo.base.yml | 6 +- hetzner/taginfo/taginfo.production.yml | 26 ++-- hetzner/tiler/README.md | 80 ++----------- hetzner/tiler/tiler.base.yml | 61 ++-------- hetzner/tiler/tiler.production.yml | 19 ++- hetzner/tiler/tiler.staging.yml | 55 +++++++++ hetzner/traefik/traefik.template.yml | 2 +- 12 files changed, 169 insertions(+), 283 deletions(-) create mode 100644 hetzner/tiler/tiler.staging.yml diff --git a/hetzner/deploy.sh b/hetzner/deploy.sh index db2d606c..e21d9f8a 100755 --- a/hetzner/deploy.sh +++ b/hetzner/deploy.sh @@ -1,150 +1,51 @@ #!/bin/bash set -e -# Parse --yes / -y so script can run non-interactively AUTO_YES=false ARGS=() for a in "$@"; do - if [[ "$a" == "--yes" || "$a" == "-y" ]]; then - AUTO_YES=true - else - ARGS+=("$a") - fi + [[ "$a" == "--yes" || "$a" == "-y" ]] && AUTO_YES=true || ARGS+=("$a") done ACTION=${ARGS[0]} SERVICE=${ARGS[1]} -ENVIRONMENT=${ARGS[2]:-staging} +ENVIRONMENT=${ARGS[2]} -# Check if first arg is an action (start/stop/restart) -if [ "$ACTION" = "start" ] || [ "$ACTION" = "stop" ] || [ "$ACTION" = "restart" ]; then - # First arg is an action, so SERVICE is $2 - if [ -z "$SERVICE" ]; then - echo "Usage: $0 [--yes|-y] start|stop|restart [staging|production]" - echo "Example: $0 start taginfo staging" - exit 1 - fi -fi - -if [ -z "$SERVICE" ]; then - echo "Usage: $0 [--yes|-y] [start|stop|restart] [staging|production]" - echo " --yes, -y Skip confirmation prompts" - echo "Examples:" - echo " $0 taginfo staging # Start service" - echo " $0 --yes start taginfo production # Start without prompting" - echo " $0 stop taginfo staging # Stop service" - echo " $0 restart taginfo staging # Restart service" +if [ -z "$SERVICE" ] || [ -z "$ENVIRONMENT" ]; then + echo "Usage: $0 [--yes|-y] start|stop|restart staging|production" + echo "Example: $0 start taginfo staging" exit 1 fi -SERVICE_DIR="$(cd "$(dirname "$0")" && pwd)/$SERVICE" -BASE_FILE="$SERVICE_DIR/$SERVICE.base.yml" -ENV_FILE="$SERVICE_DIR/$SERVICE.$ENVIRONMENT.yml" - -# Load environment variables from .env.traefik HETZNER_DIR="$(cd "$(dirname "$0")" && pwd)" -if [ -f "$HETZNER_DIR/.env.traefik" ]; then - export $(grep -v '^#' "$HETZNER_DIR/.env.traefik" | xargs) -fi +BASE_FILE="$HETZNER_DIR/$SERVICE/$SERVICE.base.yml" +ENV_FILE="$HETZNER_DIR/$SERVICE/$SERVICE.$ENVIRONMENT.yml" -# For staging, only use base file. For production, use base + environment file -if [ "$ENVIRONMENT" = "staging" ]; then - COMPOSE_CMD="docker compose -f $BASE_FILE" +[ -f "$HETZNER_DIR/.env.traefik" ] && export $(grep -v '^#' "$HETZNER_DIR/.env.traefik" | xargs) + +if [ -f "$ENV_FILE" ]; then + COMPOSE="docker compose -f $BASE_FILE -f $ENV_FILE" else - COMPOSE_CMD="docker compose -f $BASE_FILE -f $ENV_FILE" + COMPOSE="docker compose -f $BASE_FILE" fi -echo "================================================" -echo "Action: $ACTION" -echo "Service: $SERVICE" -echo "Environment: $ENVIRONMENT" -echo "Command: $COMPOSE_CMD" -echo "================================================" +echo "==> $ACTION $SERVICE ($ENVIRONMENT)" + +# Confirm before start/restart (skip with --yes) +if [[ "$ACTION" == "start" || "$ACTION" == "restart" ]] && [ "$AUTO_YES" != "true" ]; then + [ "$ENVIRONMENT" = "production" ] && echo "WARNING: Deploying to PRODUCTION" + echo "" + $COMPOSE config + echo "" + read -p "Continue? (yes/no): " confirm + [ "$confirm" != "yes" ] && echo "Cancelled." && exit 0 +fi case "$ACTION" in - start) - # Show merged configuration before deploying - echo "" - echo "Preview of merged configuration:" - echo "================================================" - - # Try to use colored output if available - if command -v bat &> /dev/null; then - $COMPOSE_CMD config | bat --language yaml --style=plain - elif command -v pygmentize &> /dev/null; then - $COMPOSE_CMD config | pygmentize -l yaml - elif command -v highlight &> /dev/null; then - $COMPOSE_CMD config | highlight --out-format=ansi --syntax=yaml - else - # Fallback: use basic colors with grep/awk - $COMPOSE_CMD config | while IFS= read -r line; do - if [[ "$line" =~ ^[[:space:]]*# ]]; then - # Comments in gray - echo -e "\033[0;90m$line\033[0m" - elif [[ "$line" =~ ^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*: ]]; then - # Keys in yellow - key=$(echo "$line" | sed 's/:.*//') - rest=$(echo "$line" | sed 's/^[^:]*://') - echo -e "\033[0;33m$key\033[0m:\033[0;36m$rest\033[0m" - elif [[ "$line" =~ ^[[:space:]]*- ]]; then - # List items in cyan - echo -e "\033[0;36m$line\033[0m" - else - echo "$line" - fi - done - fi - - echo "================================================" - echo "" - - # Ask for confirmation (skip if --yes/-y) - if [ "$AUTO_YES" != "true" ]; then - if [ "$ENVIRONMENT" = "production" ]; then - echo "⚠️ WARNING: You are about to deploy to PRODUCTION" - echo "" - read -p "Do you want to continue? (yes/no): " confirm - if [ "$confirm" != "yes" ]; then - echo "Deployment cancelled." - exit 0 - fi - else - read -p "Do you want to continue with deployment? (yes/no): " confirm - if [ "$confirm" != "yes" ]; then - echo "Deployment cancelled." - exit 0 - fi - fi - fi - - echo "" - echo "Starting deployment..." - $COMPOSE_CMD up -d - echo "" - echo "✓ Service started: $SERVICE ($ENVIRONMENT)" - echo "" - echo "================================================" - echo "Useful commands:" - echo "================================================" - echo "" - echo "# List running containers for this service:" - echo "docker ps | grep ${SERVICE}" - echo "docker exec -it ${SERVICE}_${ENVIRONMENT} bash" - echo "" - echo "# View logs:" - echo "$COMPOSE_CMD logs -f" - echo "" - ;; - stop) - $COMPOSE_CMD down - echo "Service stopped: $SERVICE ($ENVIRONMENT)" - ;; - restart) - $COMPOSE_CMD restart - echo "Service restarted: $SERVICE ($ENVIRONMENT)" - ;; - *) - echo "Unknown action: $ACTION" - exit 1 - ;; + start) $COMPOSE up -d ;; + stop) $COMPOSE down ;; + restart) $COMPOSE up -d --force-recreate ;; + *) echo "Unknown action: $ACTION"; exit 1 ;; esac + +echo "Done: $ACTION $SERVICE ($ENVIRONMENT)" diff --git a/hetzner/osmcha/osmcha.base.yml b/hetzner/osmcha/osmcha.base.yml index 1f0b050e..aa517366 100644 --- a/hetzner/osmcha/osmcha.base.yml +++ b/hetzner/osmcha/osmcha.base.yml @@ -3,12 +3,13 @@ services: image: postgis/postgis:17-3.5 container_name: osmcha-db restart: always - env_file: ./.env.osmcha + env_file: + - ./.env.osmcha volumes: - osmcha_db_data:/var/lib/postgresql/data - ./data_backup:/data_backup healthcheck: - test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + test: ["CMD-SHELL", "pg_isready"] interval: 5s timeout: 5s retries: 10 @@ -30,7 +31,8 @@ services: python manage.py migrate && python manage.py collectstatic --noinput " - env_file: ./.env.osmcha + env_file: + - ./.env.osmcha volumes: - staticfiles:/app/staticfiles depends_on: @@ -47,7 +49,8 @@ services: command: gunicorn config.wsgi -b 0.0.0.0:5000 --access-logfile - --timeout 120 --workers 4 --threads 16 # ports: # - "5100:5000" - env_file: ./.env.osmcha + env_file: + - ./.env.osmcha volumes: - staticfiles:/staticfiles depends_on: @@ -76,7 +79,8 @@ services: osmcha-cron: container_name: osmcha-cron image: ghcr.io/openhistoricalmap/osmcha-django:1bd58e1 - env_file: ./.env.osmcha + env_file: + - ./.env.osmcha depends_on: osmcha-db: condition: service_healthy diff --git a/hetzner/osmcha/osmcha.production.yml b/hetzner/osmcha/osmcha.production.yml index 1b3ff63b..849593ed 100644 --- a/hetzner/osmcha/osmcha.production.yml +++ b/hetzner/osmcha/osmcha.production.yml @@ -15,11 +15,11 @@ services: volumes: - ohmx_db:/data - ${HOME}/.aws:/root/.aws:ro - - /production/services/images/ohmx-adiff-builder/config.sh:/app/config.sh - - /production/services/images/ohmx-adiff-builder/functions.sh:/app/functions.sh - - /production/services/images/ohmx-adiff-builder/start.sh:/app/start.sh - - /production/services/images/ohmx-adiff-builder/process_min_range.sh:/app/process_min_range.sh - - /production/services/images/ohmx-adiff-builder/update.sh:/app/update.sh + - ${PWD}/images/ohmx-adiff-builder/config.sh:/app/config.sh + - ${PWD}/images/ohmx-adiff-builder/functions.sh:/app/functions.sh + - ${PWD}/images/ohmx-adiff-builder/start.sh:/app/start.sh + - ${PWD}/images/ohmx-adiff-builder/process_min_range.sh:/app/process_min_range.sh + - ${PWD}/images/ohmx-adiff-builder/update.sh:/app/update.sh networks: - ohm_network cpus: '8.0' diff --git a/hetzner/overpass/overpass.base.yml b/hetzner/overpass/overpass.base.yml index 073499c0..1dd9a349 100644 --- a/hetzner/overpass/overpass.base.yml +++ b/hetzner/overpass/overpass.base.yml @@ -1,6 +1,6 @@ services: overpass: - image: developmentseed/osmseed-overpass-api:0.1.0-0.dev.git.956.h49d677b + image: ghcr.io/osm-seed/overpass-api:0.1.0-0.dev.git.985.h3b10440 container_name: overpass # ports: # - '8085:80' diff --git a/hetzner/start_all.sh b/hetzner/start_all.sh index e29b9378..8d6baa2c 100755 --- a/hetzner/start_all.sh +++ b/hetzner/start_all.sh @@ -3,9 +3,20 @@ set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -ENVIRONMENT=${ENVIRONMENT:-staging} +ENVIRONMENT=${ENVIRONMENT} + +# Validate ENVIRONMENT is set and is either staging or production +if [ -z "$ENVIRONMENT" ]; then + echo "" + echo "Need to set ENVIRONMENT variable:" + echo " export ENVIRONMENT=staging" + echo " export ENVIRONMENT=production" + exit 1 +fi + +echo "########################## ENVIRONMENT -> $ENVIRONMENT ##########################" -# Load environment variables from .env.traefik +# Load environment variables from .env.traefik, make sure the domain is set source "$SCRIPT_DIR/.env.traefik" echo "########################## OHM_DOMAIN -> $OHM_DOMAIN ##########################" @@ -38,3 +49,8 @@ if [ "$ENVIRONMENT" = "staging" ]; then docker stop tiler_db docker stop tiler_imposm fi + +## In production we need to clean the tiler cache +docker stop tiler_s3_cleaner +## clean tiler cache +# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml run tiler_s3_cleaner tiler-cache-cleaner clean_by_prefix \ No newline at end of file diff --git a/hetzner/taginfo/taginfo.base.yml b/hetzner/taginfo/taginfo.base.yml index 2079e261..a36d8194 100644 --- a/hetzner/taginfo/taginfo.base.yml +++ b/hetzner/taginfo/taginfo.base.yml @@ -1,11 +1,9 @@ services: taginfo_web: container_name: taginfo_web - image: ghcr.io/osm-seed/taginfo-web:0.1.0-0.dev.git.983.h32750c8 - volumes: - - ${HOME}/data/staging/taginfo_data:/usr/src/app/data + image: ghcr.io/osm-seed/taginfo-web:0.1.0-0.dev.git.986.h0fae372 env_file: - - ./.env.sample + - ./.env.taginfo restart: always networks: - ohm_network diff --git a/hetzner/taginfo/taginfo.production.yml b/hetzner/taginfo/taginfo.production.yml index b3b518a7..5ac2d5a0 100644 --- a/hetzner/taginfo/taginfo.production.yml +++ b/hetzner/taginfo/taginfo.production.yml @@ -1,21 +1,33 @@ services: + taginfo_data: + container_name: taginfo_data + image: ghcr.io/osm-seed/taginfo:0.1.0-0.dev.git.984.hb289ff1 volumes: + - /var/run/docker.sock:/var/run/docker.sock - ${HOME}/data/production/taginfo_data:/usr/src/app/data - ${HOME}/data/production/taginfo_data_planet:/osm/planet/var environment: - AWS_S3_BUCKET=planet.openhistoricalmap.org + - DOCKER_CONFIG_ENVIRONMENT=production command: - /bin/bash - -lc - | set -ex - # Run every 3 days at 3:00 AM - echo "0 3 1-31/3 * * /usr/src/app/start.sh >> /var/log/taginfo-cron.log 2>&1" > /tmp/cron_logs - crontab /tmp/cron_logs + echo "#!/bin/bash + /usr/src/app/start.sh + sleep 7200 + # restart web container + curl -X POST --unix-socket /var/run/docker.sock http://v1.41/containers/taginfo_web/restart" > /run_task.sh + chmod +x /run_task.sh + + # 2. Set cron: Run every 3 days at 3:00 AM + echo "0 3 */3 * * /run_task.sh >> /var/log/taginfo-cron.log 2>&1" | crontab - + touch /var/log/taginfo-cron.log cron -f - - taginfo_web: - volumes: - - ${HOME}/data/production/taginfo_data_proceced:/usr/src/app/data \ No newline at end of file + env_file: + - ./.env.taginfo + networks: + - ohm_network \ No newline at end of file diff --git a/hetzner/tiler/README.md b/hetzner/tiler/README.md index 7c7bbcd6..2b013ffd 100644 --- a/hetzner/tiler/README.md +++ b/hetzner/tiler/README.md @@ -27,14 +27,14 @@ docker compose -f hetzner/tiler/tiler.base.yml up -d ```sh docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up -d -# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up db_production -d --force-recreate -# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up imposm_production -d --force-recreate -# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_server_production -d --force-recreate -# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_sqs_cleaner_production -d --force-recreate -# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tile_global_seeding_production -d --force-recreate -# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tile_coverage_seeding_production -d --force-recreate -# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml run tiler_s3_cleaner_production tiler-cache-cleaner clean_by_prefix -# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_monitor_production -d --force-recreate +# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_db -d --force-recreate +# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_imposm -d --force-recreate +# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_server -d --force-recreate +# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_sqs_cleaner -d --force-recreate +# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tile_global_seeding -d --force-recreate +# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tile_coverage_seeding -d --force-recreate +# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml run tiler_s3_cleaner tiler-cache-cleaner clean_by_prefix +# docker compose -f hetzner/tiler/tiler.base.yml -f hetzner/tiler/tiler.production.yml up tiler_monitor -d --force-recreate ``` @@ -55,67 +55,3 @@ Here’s your README section rewritten in clearer English and with improved form ## Environment variables The environment variables for Tiler are quite large, so they need to be set up manually before deploying production services. - - -```sh -## imposm -TILER_IMPORT_FROM=osm -TILER_IMPORT_PBF_URL=https://s3.amazonaws.com/planet.openhistoricalmap.org/planet/planet-250729_0102.osm.pbf -REPLICATION_URL=http://s3.amazonaws.com/planet.openhistoricalmap.org/replication/minute/ -SEQUENCE_NUMBER=1742500 -OVERWRITE_STATE=false -UPLOAD_EXPIRED_FILES=true -IMPORT_NATURAL_EARTH=true -IMPORT_OSM_LAND=true -IMPOSM3_IMPORT_LAYERS=all -CLOUDPROVIDER=aws -AWS_S3_BUCKET=s3://planet-staging.openhistoricalmap.org -AWS_ACCESS_KEY_ID=afdc # permission to upload expiration files in s3 -AWS_SECRET_ACCESS_KEY=adf -REFRESH_MVIEWS=true - -### tiler server -TILER_SERVER_PORT=9090 -TILER_CACHE_BASEPATH=/mnt/data -TILER_CACHE_MAX_ZOOM=20 -EXECUTE_VACUUM_ANALYZE=false -EXECUTE_REINDEX=false -TILER_CACHE_CLOUD_INFRASTRUCTURE=hetzner -TILER_CACHE_TYPE=s3 -TILER_CACHE_BUCKET=tiler-cache-staging -TILER_CACHE_REGION=hel1 -TILER_CACHE_AWS_ACCESS_KEY_ID=abc #comes from hetzner -TILER_CACHE_AWS_SECRET_ACCESS_KEY=xyz # comes from hetzner -TILER_CACHE_AWS_ENDPOINT=https://hel1.your-objectstorage.com - -### tiler cache -#### env vars to read sqs messages -AWS_REGION_NAME=us-east-1 -AWS_ACCESS_KEY_ID=afdc # permission to read SQS messages. -AWS_SECRET_ACCESS_KEY=adf -SQS_QUEUE_URL=https://sqs.us-east-1.amazonaws.com/1234567890/tiler-imposm3-expired-files-staging # SQS url - -ENVIRONMENT=production -DOCKER_IMAGE=none -NODEGROUP_TYPE=web_large -MAX_ACTIVE_JOBS=10 -DELETE_OLD_JOBS_AGE=3600 -EXECUTE_PURGE=true -EXECUTE_SEED=false -PURGE_MIN_ZOOM=3 -PURGE_MAX_ZOOM=10 -SEED_MIN_ZOOM=0 -SEED_MAX_ZOOM=8 -SEED_CONCURRENCY=64 -PURGE_CONCURRENCY=64 -ZOOM_LEVELS_TO_DELETE=8,9,10,11,12,13,14,15,16,17,18,19,20 -S3_BUCKET_CACHE_TILER=tiler-cache-staging -S3_BUCKET_PATH_FILES=mnt/data/osm -DELAYED_CLEANUP_TIMER_SECONDS=3600 # 1 hour - -## tiler monitoring -DOCKER_CONFIG_ENVIRONMENT=staging -NIM_NUMBER_LANGUAGES=5 -FORCE_LANGUAGES_GENERATION=false -EVALUATION_INTERVAL=3600 -``` \ No newline at end of file diff --git a/hetzner/tiler/tiler.base.yml b/hetzner/tiler/tiler.base.yml index f5784eb9..6e79d492 100644 --- a/hetzner/tiler/tiler.base.yml +++ b/hetzner/tiler/tiler.base.yml @@ -1,44 +1,4 @@ services: - tiler_db: - container_name: tiler_db - image: ghcr.io/openhistoricalmap/tiler-db:0.0.1-0.dev.git.2166.hc55c4cd - volumes: - - tiler_pgdata:/var/lib/postgresql/data - - ./config/postgresql.staging.conf:/etc/postgresql/postgresql.conf - environment: - - PGDATA=/var/lib/postgresql/data - - POSTGRES_CONFIG_FILE=/etc/postgresql/postgresql.conf - command: - - postgres - - "-c" - - "config_file=/etc/postgresql/postgresql.conf" - ports: - - "54321:5432" - env_file: - - .env.tiler - networks: - - ohm_network - - tiler_imposm: - container_name: tiler_imposm - image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3208.h6ef73bb - # image: tiler-imposm:staging - # build: - # context: ../../images/tiler-imposm - # dockerfile: Dockerfile - volumes: - - tiler_imposm_data:/mnt/data - command: - - sh - - -c - - | - ./start.sh - env_file: - - .env.tiler - restart: always - networks: - - ohm_network - tiler_server: container_name: tiler_server image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3225.h2122f3e @@ -56,20 +16,13 @@ services: networks: - ohm_network -# volumes: -# tiler_pgdata: -# driver: local -# driver_opts: -# type: none -# o: bind -# device: /mnt/HC_Volume_104590709/staging/tiler/pgdata - -# tiler_imposm_data: -# driver: local -# driver_opts: -# type: none -# o: bind -# device: /mnt/HC_Volume_104590709/staging/tiler/imposmdata +volumes: + tiler_pgdata: + driver: local + name: tiler_db_11_02 + tiler_imposm_data: + driver: local + name: tiler_imposm_11_02 networks: ohm_network: diff --git a/hetzner/tiler/tiler.production.yml b/hetzner/tiler/tiler.production.yml index f049ead2..f4d6010e 100644 --- a/hetzner/tiler/tiler.production.yml +++ b/hetzner/tiler/tiler.production.yml @@ -1,18 +1,26 @@ services: tiler_db: + container_name: tiler_db image: ghcr.io/openhistoricalmap/tiler-db:0.0.1-0.dev.git.2166.hc55c4cd volumes: !overwrite - tiler_pgdata:/var/lib/postgresql/data - ./config/postgresql.production.conf:/etc/postgresql/postgresql.conf - ports: - - "54329:5432" + # ports: + # - "54329:5432" + env_file: + - .env.tiler mem_limit: 55G cpus: "28.0" + networks: + - ohm_network tiler_imposm: + container_name: tiler_imposm image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3208.h6ef73bb volumes: - tiler_imposm_data:/mnt/data + env_file: + - .env.tiler command: - sh - -c @@ -31,8 +39,8 @@ services: tiler_server: container_name: tiler_server image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3225.h2122f3e - ports: - - "9090:9090" + # ports: + # - "9090:9090" restart: always networks: - ohm_network @@ -63,6 +71,9 @@ services: tiler_s3_cleaner: container_name: tiler_s3_cleaner image: ghcr.io/openhistoricalmap/tiler-cache:0.0.1-0.dev.git.3245.hffaf924 + command: + - tiler-cache-cleaner + - clean_by_prefix env_file: - .env.tiler networks: diff --git a/hetzner/tiler/tiler.staging.yml b/hetzner/tiler/tiler.staging.yml new file mode 100644 index 00000000..e8f91d5e --- /dev/null +++ b/hetzner/tiler/tiler.staging.yml @@ -0,0 +1,55 @@ +services: + tiler_db: + container_name: tiler_db + image: ghcr.io/openhistoricalmap/tiler-db:0.0.1-0.dev.git.2166.hc55c4cd + volumes: + - tiler_pgdata:/var/lib/postgresql/data + - ./config/postgresql.staging.conf:/etc/postgresql/postgresql.conf + environment: + - PGDATA=/var/lib/postgresql/data + - POSTGRES_CONFIG_FILE=/etc/postgresql/postgresql.conf + command: + - postgres + - "-c" + - "config_file=/etc/postgresql/postgresql.conf" + # ports: + # - "54321:5432" + env_file: + - .env.tiler + networks: + - ohm_network + tiler_imposm: + container_name: tiler_imposm + image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3208.h6ef73bb + # image: tiler-imposm:staging + # build: + # context: ../../images/tiler-imposm + # dockerfile: Dockerfile + volumes: + - tiler_imposm_data:/mnt/data + command: + - sh + - -c + - | + ./start.sh + env_file: + - .env.tiler + restart: always + networks: + - ohm_network +volumes: + tiler_pgdata: + driver: local + name: tiler_db_11_02 + driver_opts: + type: none + o: bind + device: /mnt/HC_Volume_104590709/staging/tiler/pgdata + + tiler_imposm_data: + driver: local + name: tiler_imposm_11_02 + driver_opts: + type: none + o: bind + device: /mnt/HC_Volume_104590709/staging/tiler/imposmdata diff --git a/hetzner/traefik/traefik.template.yml b/hetzner/traefik/traefik.template.yml index cd5c66e4..68357aa1 100644 --- a/hetzner/traefik/traefik.template.yml +++ b/hetzner/traefik/traefik.template.yml @@ -172,7 +172,7 @@ http: overpass_api: loadBalancer: servers: - - url: http://overpass_api:80 + - url: http://overpass:80 osmcha_web: loadBalancer: From 09bb75263d88db4ecd1c9b72ba69b67b1166c935 Mon Sep 17 00:00:00 2001 From: "Ruben L. Mendoza" Date: Tue, 17 Feb 2026 13:26:45 -0500 Subject: [PATCH 2/8] Update cgimap, teginfo and overpass config (#698) * Fix cgimap attribution setup * Deploy in staging * Update taginfo cronjob to process db files * Update taginfo script * Fix endpoint * Update osm-seed version * Update overpass version * Update overpass docker image --- .github/workflows/chartpress.yaml | 16 ++++++++-------- hetzner/overpass/overpass.base.yml | 12 +++--------- hetzner/taginfo/taginfo.production.yml | 10 ++++++---- images/cgimap/Dockerfile | 14 +++++++++----- ohm/requirements.yaml | 2 +- values.production.template.yaml | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/chartpress.yaml b/.github/workflows/chartpress.yaml index e65751ed..4be2054b 100644 --- a/.github/workflows/chartpress.yaml +++ b/.github/workflows/chartpress.yaml @@ -4,7 +4,7 @@ on: branches: - 'main' - 'staging' - - 'disable_alb' + - 'configs_cgimap' jobs: build: runs-on: ubuntu-22.04 @@ -71,7 +71,7 @@ jobs: OHM_SLACK_WEBHOOK_URL: ${{ secrets.OHM_SLACK_WEBHOOK_URL }} ################ Staging secrets ################ - name: Staging - substitute secrets - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/disable_alb' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/configs_cgimap' uses: bluwy/substitute-string-action@v1 with: _input-file: 'values.staging.template.yaml' @@ -189,14 +189,14 @@ jobs: PRODUCTION_OPENSTREETMAP_AUTH_SECRET: ${{ secrets.PRODUCTION_OPENSTREETMAP_AUTH_SECRET }} - name: AWS Credentials - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/disable_alb' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/configs_cgimap' uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Setup Kubectl and Helm Dependencies - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/disable_alb' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/configs_cgimap' run: | sudo pip install awscli --ignore-installed six sudo curl -L -o /usr/bin/kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.17.7/2020-07-08/bin/linux/amd64/kubectl @@ -210,22 +210,22 @@ jobs: helm version - name: Update kube-config staging - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/disable_alb' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/configs_cgimap' run: aws eks --region us-east-1 update-kubeconfig --name osmseed-staging - name: Update kube-config prod if: github.ref == 'refs/heads/main' run: aws eks --region us-east-1 update-kubeconfig --name osmseed-production-v2 - name: Add Helm repository - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/disable_alb' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/configs_cgimap' run: | helm repo add osm-seed https://osm-seed.github.io/osm-seed-chart/ helm repo update - name: Install helm dependencies for - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/disable_alb' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/configs_cgimap' run: cd ohm && helm dep up # Staging - name: Staging - helm deploy - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/disable_alb' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/configs_cgimap' run: helm upgrade --install staging --wait ohm/ -f values.staging.yaml -f ohm/values.yaml # Production - name: Production - helm deploy diff --git a/hetzner/overpass/overpass.base.yml b/hetzner/overpass/overpass.base.yml index 1dd9a349..324b40f0 100644 --- a/hetzner/overpass/overpass.base.yml +++ b/hetzner/overpass/overpass.base.yml @@ -1,6 +1,6 @@ services: overpass: - image: ghcr.io/osm-seed/overpass-api:0.1.0-0.dev.git.985.h3b10440 + image: ghcr.io/osm-seed/overpass-api:0.1.0-0.dev.git.989.h5488a16 container_name: overpass # ports: # - '8085:80' @@ -9,18 +9,13 @@ services: environment: OVERPASS_META: attic OVERPASS_MODE: init - OVERPASS_PLANET_URL: https://s3.amazonaws.com/planet.openhistoricalmap.org/planet/planet-260210_0334.osm.pbf + OVERPASS_PLANET_URL: https://s3.amazonaws.com/planet.openhistoricalmap.org/planet/planet-260216_0301.osm.pbf OVERPASS_DIFF_URL: http://s3.amazonaws.com/planet.openhistoricalmap.org/replication/minute OVERPASS_RULES_LOAD: 10 - OVERPASS_PLANET_PREPROCESS: "mv /db/planet.osm.bz2 /db/planet.osm.pbf && osmium cat -o /db/planet.osm.bz2 /db/planet.osm.pbf && rm /db/planet.osm.pbf" OVERPASS_REPLICATION_SEQUENCE_NUMBER: 1796000 OVERPASS_ALLOW_DUPLICATE_QUERIES: yes - # Need to overwrite - BRANCH_NAME: main - REPO: OpenHistoricalMap/ohm-deploy - ENVIRONMENT: production - REMOTE_APP_DIR: /production/overpass restart: always + ## Disable healthcheck during initialization phase to prevent premature restarts healthcheck: test: ["CMD-SHELL", "curl -f http://localhost/ || exit 1"] interval: 30s @@ -38,4 +33,3 @@ volumes: overpass_data: driver: local name: overpass_db_11_02_2026_v4 - diff --git a/hetzner/taginfo/taginfo.production.yml b/hetzner/taginfo/taginfo.production.yml index 5ac2d5a0..829e1dd6 100644 --- a/hetzner/taginfo/taginfo.production.yml +++ b/hetzner/taginfo/taginfo.production.yml @@ -16,18 +16,20 @@ services: - | set -ex echo "#!/bin/bash + rm -rf /usr/src/app/data/* /usr/src/app/start.sh sleep 7200 # restart web container - curl -X POST --unix-socket /var/run/docker.sock http://v1.41/containers/taginfo_web/restart" > /run_task.sh + curl -v -X POST --unix-socket /var/run/docker.sock http://localhost/v1.41/containers/taginfo_web/restart" > /run_task.sh chmod +x /run_task.sh - + /run_task.sh # 2. Set cron: Run every 3 days at 3:00 AM - echo "0 3 */3 * * /run_task.sh >> /var/log/taginfo-cron.log 2>&1" | crontab - + echo "0 8 */3 * * /run_task.sh >> /var/log/taginfo-cron.log 2>&1" | crontab - touch /var/log/taginfo-cron.log cron -f env_file: - ./.env.taginfo networks: - - ohm_network \ No newline at end of file + - ohm_network + \ No newline at end of file diff --git a/images/cgimap/Dockerfile b/images/cgimap/Dockerfile index 59a6bc1f..522d9ee6 100644 --- a/images/cgimap/Dockerfile +++ b/images/cgimap/Dockerfile @@ -17,15 +17,19 @@ WORKDIR /app # Clone application. ENV CGIMAP_GITSHA=01e33669bfee17d55849d6f731a174b8058ca630 RUN git clone https://github.com/zerebubuth/openstreetmap-cgimap.git /app \ -&& git checkout $CGIMAP_GITSHA \ -&& sed -i 's#OpenStreetMap and contributors#OpenHistoricalMap is dedicated to the public domain except where otherwise noted.#g' include/cgimap/output_formatter.hpp \ -&& sed -i 's#http://www.openstreetmap.org/copyright#https://www.openhistoricalmap.org/copyright#g' include/cgimap/output_formatter.hpp \ -&& sed -i 's#http://opendatacommons.org/licenses/odbl/1-0/#https://creativecommons.org/public-domain/cc0/#g' include/cgimap/output_formatter.hpp +&& git checkout $CGIMAP_GITSHA ARG JOBS=1 ARG BUILD_TESTING=OFF RUN mkdir build && cd build && \ - CXXFLAGS="-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2" cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=${BUILD_TESTING} -DCMAKE_BUILD_TYPE=Release && \ + CXXFLAGS="-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2" cmake .. \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_TESTING=${BUILD_TESTING} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCGIMAP_COPYRIGHT_MESSAGE="OpenHistoricalMap is dedicated to the public domain except where otherwise noted." \ + -DCGIMAP_ATTRIBUTION_MESSAGE="https://www.openhistoricalmap.org/copyright" \ + -DCGIMAP_LICENSE_MESSAGE="https://creativecommons.org/public-domain/cc0/" && \ make -j${JOBS} && \ cmake --build . -t package diff --git a/ohm/requirements.yaml b/ohm/requirements.yaml index 903dca8e..c08689f2 100644 --- a/ohm/requirements.yaml +++ b/ohm/requirements.yaml @@ -1,4 +1,4 @@ dependencies: - name: osm-seed - version: '0.1.0-0.dev.git.984.h985db07' + version: '0.1.0-0.dev.git.987.h56d7810' repository: https://osm-seed.github.io/osm-seed-chart/ \ No newline at end of file diff --git a/values.production.template.yaml b/values.production.template.yaml index 880f170b..4657e7ea 100644 --- a/values.production.template.yaml +++ b/values.production.template.yaml @@ -1020,7 +1020,7 @@ osm-seed: # Variables for replication nomitoring task # ==================================================================================================== monitoringReplication: - enabled: true + enabled: false priorityClass: medium-priority serviceAccount: enabled: true From a5b4b75800d823907e50b76dfcb98292bb4db384 Mon Sep 17 00:00:00 2001 From: "Ruben L. Mendoza" Date: Wed, 18 Feb 2026 06:39:36 -0500 Subject: [PATCH 3/8] Adding non-administrative boundaries in vector tiles (#684) * Store all the objects that have boundary=* * Remove unused imposm config * Add role and add index for osm_admin_relation_members * Script optimization for admin * Add query to create non admin boundaries views * Add config to display non_admin in tegola * Add extra columns for no-bounduary areas * Add religion, timezone, postal_code, etc attribute in no_admin layers * Rename source layer to non_admin --- .../config/layers/admin_areas.json | 2 +- .../config/layers/admin_lines.json | 2 +- ...aries.json => admin_relation_members.json} | 8 +- .../config/layers/relations_boundaries.json | 68 ----- .../ohm_mviews/admin_boundaries_areas.sql | 2 +- .../ohm_mviews/admin_boundaries_centroids.sql | 2 +- .../ohm_mviews/admin_boundaries_lines.sql | 215 +++++++++++--- .../ohm_mviews/non_admin_boundaries_areas.sql | 41 +++ .../queries/utils/create_01_areas_mview.sql | 10 +- .../queries/utils/create_generic_mview.sql | 4 + images/tiler-imposm/scripts/create_mviews.sh | 2 + images/tiler-imposm/scripts/refresh_mviews.sh | 24 ++ .../tiler-server/config/config.template.toml | 22 +- .../providers/non_admin_boundaries_areas.toml | 264 +++++++++++++++++ .../non_admin_boundaries_centroids.toml | 265 ++++++++++++++++++ images/tiler-server/scripts/build_config.py | 11 +- 16 files changed, 831 insertions(+), 111 deletions(-) rename images/tiler-imposm/config/layers/{relation_members_boundaries.json => admin_relation_members.json} (92%) delete mode 100644 images/tiler-imposm/config/layers/relations_boundaries.json create mode 100644 images/tiler-imposm/queries/ohm_mviews/non_admin_boundaries_areas.sql create mode 100644 images/tiler-server/config/providers/non_admin_boundaries_areas.toml create mode 100644 images/tiler-server/config/providers/non_admin_boundaries_centroids.toml diff --git a/images/tiler-imposm/config/layers/admin_areas.json b/images/tiler-imposm/config/layers/admin_areas.json index 3d2dbf26..755a67b1 100644 --- a/images/tiler-imposm/config/layers/admin_areas.json +++ b/images/tiler-imposm/config/layers/admin_areas.json @@ -65,7 +65,7 @@ "type": "polygon", "mapping": { "boundary": [ - "administrative" + "__any__" ] } } diff --git a/images/tiler-imposm/config/layers/admin_lines.json b/images/tiler-imposm/config/layers/admin_lines.json index 3e35bb63..1940b89b 100644 --- a/images/tiler-imposm/config/layers/admin_lines.json +++ b/images/tiler-imposm/config/layers/admin_lines.json @@ -65,7 +65,7 @@ "type": "linestring", "mapping": { "boundary": [ - "administrative" + "__any__" ] } } diff --git a/images/tiler-imposm/config/layers/relation_members_boundaries.json b/images/tiler-imposm/config/layers/admin_relation_members.json similarity index 92% rename from images/tiler-imposm/config/layers/relation_members_boundaries.json rename to images/tiler-imposm/config/layers/admin_relation_members.json index 3a70af69..b8674207 100644 --- a/images/tiler-imposm/config/layers/relation_members_boundaries.json +++ b/images/tiler-imposm/config/layers/admin_relation_members.json @@ -9,7 +9,7 @@ }, "generalized_tables": {}, "tables": { - "relation_members_boundaries": { + "admin_relation_members": { "type": "relation_member", "fields": [ { @@ -60,6 +60,10 @@ "name": "member", "type": "member_id" }, + { + "name": "role", + "type": "member_role" + }, { "name": "me_maritime", "type": "string", @@ -80,7 +84,7 @@ ], "mapping": { "boundary": [ - "administrative" + "__any__" ] } } diff --git a/images/tiler-imposm/config/layers/relations_boundaries.json b/images/tiler-imposm/config/layers/relations_boundaries.json deleted file mode 100644 index 37ca731b..00000000 --- a/images/tiler-imposm/config/layers/relations_boundaries.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "tags": { - "load_all": true, - "exclude": [ - "created_by", - "source", - "source:datetime" - ] - }, - "generalized_tables": {}, - "tables": { - "relations_boundaries": { - "type": "relation", - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "integer", - "name": "admin_level", - "key": "admin_level" - }, - { - "key": "start_date", - "name": "start_date", - "type": "string" - }, - { - "key": "end_date", - "name": "end_date", - "type": "string" - }, - { - "type": "boolint", - "name": "has_label", - "key": false - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "mapping": { - "boundary": [ - "administrative" - ] - } - } - } -} diff --git a/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_areas.sql b/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_areas.sql index ac2b3dcc..3dcad538 100644 --- a/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_areas.sql +++ b/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_areas.sql @@ -1,7 +1,7 @@ -- ============================================================================ -- Create materialized views for admin boundaries areas -- ============================================================================ -DROP FUNCTION MATERIALIZED VIEW IF EXISTS mv_admin_boundaries_areas_z16_20 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS mv_admin_boundaries_areas_z16_20 CASCADE; SELECT create_areas_mview( 'osm_admin_areas', 'mv_admin_boundaries_areas_z16_20', 1, 0, 'id, osm_id, type', 'admin_level IN (1,2,3,4,5,6,7,8,9,10,11)'); SELECT create_area_mview_from_mview('mv_admin_boundaries_areas_z16_20','mv_admin_boundaries_areas_z13_15', 5, 0.0, NULL); diff --git a/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_centroids.sql b/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_centroids.sql index 33668901..cc821616 100644 --- a/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_centroids.sql +++ b/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_centroids.sql @@ -73,7 +73,7 @@ BEGIN FROM %I WHERE name IS NOT NULL AND name <> '' AND osm_id NOT IN ( - SELECT osm_id FROM osm_relation_members WHERE role = 'label' + SELECT osm_id FROM osm_admin_relation_members WHERE role = 'label' AND type = 'administrative' )%s; $sql$, tmp_mview_name, all_cols, source_mview, custom_filter); diff --git a/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_lines.sql b/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_lines.sql index f663bb23..04fc5542 100644 --- a/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_lines.sql +++ b/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_lines.sql @@ -1,28 +1,28 @@ --- This script creates materialized views for admin boundaries (lines) conbined from tables osm_relation_members_boundaries and osm_admin_lines +-- This script creates materialized views for admin boundaries (lines) combined from tables osm_admin_relation_members and osm_admin_lines -- ============================================================================ ---STEP 1: Add New Columns in osm_relation_members_boundaries and osm_admin_lines +-- STEP 1: Add New Columns in osm_admin_relation_members and osm_admin_lines -- ============================================================================ -SELECT log_notice('STEP 1: Adding new columns in osm_relation_members_boundaries and osm_admin_lines table'); +SELECT log_notice('STEP 1: Adding new columns in osm_admin_relation_members and osm_admin_lines table'); --- osm_relation_members_boundaries +-- osm_admin_relation_members DO $$ BEGIN IF NOT EXISTS ( SELECT 1 FROM information_schema.columns WHERE table_schema = 'public' - AND table_name = 'osm_relation_members_boundaries' + AND table_name = 'osm_admin_relation_members' AND column_name = 'start_decdate' ) THEN - ALTER TABLE osm_relation_members_boundaries ADD COLUMN start_decdate DOUBLE PRECISION; + ALTER TABLE osm_admin_relation_members ADD COLUMN start_decdate DOUBLE PRECISION; END IF; IF NOT EXISTS ( SELECT 1 FROM information_schema.columns WHERE table_schema = 'public' - AND table_name = 'osm_relation_members_boundaries' + AND table_name = 'osm_admin_relation_members' AND column_name = 'end_decdate' ) THEN - ALTER TABLE osm_relation_members_boundaries ADD COLUMN end_decdate DOUBLE PRECISION; + ALTER TABLE osm_admin_relation_members ADD COLUMN end_decdate DOUBLE PRECISION; END IF; END $$; @@ -49,20 +49,184 @@ END $$; -- ============================================================================ --- STEP 2: Create the Trigger, which will call the function above +-- STEP 2: Backfill Existing Data using temp table + disabled indexes -- ============================================================================ -SELECT log_notice('STEP 2: Create trigger to convert date to decimal for new/updated objects in osm_relation_members_boundaries and osm_admin_lines table'); --- osm_relation_members_boundaries trigger +-- Configuracion temporal para mejor rendimiento +SET LOCAL work_mem = '512MB'; +SET LOCAL maintenance_work_mem = '1GB'; + +-- ============================================ +-- 2.1 Backfill osm_admin_relation_members +-- ============================================ +SELECT log_notice('STEP 2.1: Backfill existing data for osm_admin_relation_members table'); + +-- Guardar definiciones de indices antes de dropearlos +CREATE TEMP TABLE saved_indexes_relation_members AS +SELECT indexname, indexdef +FROM pg_indexes +WHERE tablename = 'osm_admin_relation_members' + AND indexname NOT LIKE '%_pkey'; + +-- Dropear indices temporalmente (excepto PK) +DO $$ +DECLARE + idx RECORD; +BEGIN + FOR idx IN + SELECT indexname FROM pg_indexes + WHERE tablename = 'osm_admin_relation_members' + AND indexname NOT LIKE '%_pkey' + LOOP + EXECUTE 'DROP INDEX IF EXISTS ' || idx.indexname; + RAISE NOTICE 'Dropped index: %', idx.indexname; + END LOOP; +END $$; + +-- Crear tabla temporal con valores pre-calculados +SELECT log_notice('STEP 2.1: Creating temp table with pre-calculated values for osm_admin_relation_members'); +CREATE TEMP TABLE temp_admin_relation_members_backfill AS +SELECT + ctid AS row_ctid, + isodatetodecimaldate(pad_date(start_date::TEXT, 'start')::TEXT, FALSE) AS start_decdate, + isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE) AS end_decdate +FROM osm_admin_relation_members +WHERE ST_GeometryType(geometry) = 'ST_LineString' + AND type = 'administrative' + AND (start_decdate IS NULL OR end_decdate IS NULL); + +CREATE INDEX ON temp_admin_relation_members_backfill(row_ctid); + +-- UPDATE masivo con JOIN +SELECT log_notice('STEP 2.1: Updating osm_admin_relation_members with pre-calculated values'); +UPDATE osm_admin_relation_members t +SET start_decdate = tmp.start_decdate, + end_decdate = tmp.end_decdate +FROM temp_admin_relation_members_backfill tmp +WHERE t.ctid = tmp.row_ctid; + +DROP TABLE temp_admin_relation_members_backfill; + +-- Recrear todos los indices guardados +SELECT log_notice('STEP 2.1: Recreating indexes for osm_admin_relation_members'); +DO $$ +DECLARE + idx RECORD; +BEGIN + FOR idx IN SELECT indexname, indexdef FROM saved_indexes_relation_members + LOOP + EXECUTE idx.indexdef; + RAISE NOTICE 'Recreated index: %', idx.indexname; + END LOOP; +END $$; + +DROP TABLE saved_indexes_relation_members; +SELECT log_notice('STEP 2.1: osm_admin_relation_members backfill complete'); + + +-- ============================================ +-- 2.2 Backfill osm_admin_lines +-- ============================================ +SELECT log_notice('STEP 2.2: Backfill existing data for osm_admin_lines table'); + +-- Guardar definiciones de indices antes de dropearlos +CREATE TEMP TABLE saved_indexes_admin_lines AS +SELECT indexname, indexdef +FROM pg_indexes +WHERE tablename = 'osm_admin_lines' + AND indexname NOT LIKE '%_pkey'; + +-- Dropear indices temporalmente (excepto PK) +DO $$ +DECLARE + idx RECORD; +BEGIN + FOR idx IN + SELECT indexname FROM pg_indexes + WHERE tablename = 'osm_admin_lines' + AND indexname NOT LIKE '%_pkey' + LOOP + EXECUTE 'DROP INDEX IF EXISTS ' || idx.indexname; + RAISE NOTICE 'Dropped index: %', idx.indexname; + END LOOP; +END $$; + +-- Crear tabla temporal con valores pre-calculados +SELECT log_notice('STEP 2.2: Creating temp table with pre-calculated values for osm_admin_lines'); +CREATE TEMP TABLE temp_admin_lines_backfill AS +SELECT + ctid AS row_ctid, + isodatetodecimaldate(pad_date(start_date::TEXT, 'start')::TEXT, FALSE) AS start_decdate, + isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE) AS end_decdate +FROM osm_admin_lines +WHERE ST_GeometryType(geometry) = 'ST_LineString' + AND type = 'administrative' + AND (start_decdate IS NULL OR end_decdate IS NULL); + +CREATE INDEX ON temp_admin_lines_backfill(row_ctid); + +-- UPDATE masivo con JOIN +SELECT log_notice('STEP 2.2: Updating osm_admin_lines with pre-calculated values'); +UPDATE osm_admin_lines t +SET start_decdate = tmp.start_decdate, + end_decdate = tmp.end_decdate +FROM temp_admin_lines_backfill tmp +WHERE t.ctid = tmp.row_ctid; + +DROP TABLE temp_admin_lines_backfill; + +-- Recrear todos los indices guardados +SELECT log_notice('STEP 2.2: Recreating indexes for osm_admin_lines'); +DO $$ +DECLARE + idx RECORD; +BEGIN + FOR idx IN SELECT indexname, indexdef FROM saved_indexes_admin_lines + LOOP + EXECUTE idx.indexdef; + RAISE NOTICE 'Recreated index: %', idx.indexname; + END LOOP; +END $$; + +DROP TABLE saved_indexes_admin_lines; +SELECT log_notice('STEP 2.2: osm_admin_lines backfill complete'); + + +-- ============================================================================ +-- STEP 2.3: Create additional indexes for query performance (after backfill) +-- ============================================================================ +SELECT log_notice('STEP 2.3: Creating additional indexes for query performance'); + +CREATE INDEX IF NOT EXISTS osm_admin_relation_members_type_idx ON osm_admin_relation_members (type); +CREATE INDEX IF NOT EXISTS osm_admin_lines_type_idx ON osm_admin_lines (type); +CREATE INDEX IF NOT EXISTS osm_relation_members_role_idx ON osm_admin_relation_members (role); + +CREATE INDEX IF NOT EXISTS osm_admin_relation_members_linestring_idx +ON osm_admin_relation_members (admin_level, member, type) +WHERE ST_GeometryType(geometry) = 'ST_LineString'; + +CREATE INDEX IF NOT EXISTS osm_admin_lines_linestring_idx +ON osm_admin_lines (type) +WHERE ST_GeometryType(geometry) = 'ST_LineString'; + +SELECT log_notice('STEP 2.3: Indexes created successfully'); + + +-- ============================================================================ +-- STEP 3: Create the Trigger, which will call the function above +-- ============================================================================ +SELECT log_notice('STEP 3: Create trigger to convert date to decimal for new/updated objects in osm_admin_relation_members and osm_admin_lines table'); + +-- osm_admin_relation_members trigger DO $$ BEGIN IF NOT EXISTS ( SELECT 1 FROM pg_trigger - WHERE tgname = 'trigger_decimal_dates_osm_relation_members_boundaries' + WHERE tgname = 'trigger_decimal_dates_osm_admin_relation_members' ) THEN - CREATE TRIGGER trigger_decimal_dates_osm_relation_members_boundaries + CREATE TRIGGER trigger_decimal_dates_osm_admin_relation_members BEFORE INSERT OR UPDATE - ON osm_relation_members_boundaries + ON osm_admin_relation_members FOR EACH ROW EXECUTE FUNCTION convert_dates_to_decimal(); END IF; @@ -83,29 +247,11 @@ BEGIN END IF; END $$; --- ============================================================================ --- STEP 3: Backfill Existing Data, Set timeout to 40 minutes (2400000 milliseconds) for the current session, this takes quite a while, sincecurrnelty thrre are ~5 million rows in the table --- ============================================================================ -SELECT log_notice('STEP 3: Backfill existing data for osm_relation_members_boundaries table'); -SET statement_timeout = 2400000; -UPDATE osm_relation_members_boundaries -SET start_decdate = isodatetodecimaldate(pad_date(start_date::TEXT, 'start')::TEXT, FALSE), - end_decdate = isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE) -WHERE ST_GeometryType(geometry) = 'ST_LineString'; - - -SELECT log_notice('STEP 3: Backfill existing data for osm_admin_lines table'); -SET statement_timeout = 2400000; -UPDATE osm_admin_lines -SET start_decdate = isodatetodecimaldate(pad_date(start_date::TEXT, 'start')::TEXT, FALSE), - end_decdate = isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE) -WHERE ST_GeometryType(geometry) = 'ST_LineString'; - -- ============================================================================ -- STEP 4: Create a materialized view that merges lines based on start_decdate and end_decdate, admin_level, member and type -- ============================================================================ -SELECT log_notice('STEP 4: Create a materialized view that merges lines based on start_decdate and end_decdate using osm_relation_members_boundaries table'); +SELECT log_notice('STEP 4: Create a materialized view that merges lines based on start_decdate and end_decdate using osm_admin_relation_members table'); DROP MATERIALIZED VIEW IF EXISTS mv_relation_members_boundaries CASCADE; @@ -122,8 +268,9 @@ WITH ordered AS ( PARTITION BY admin_level, member, type ORDER BY start_decdate NULLS FIRST ) AS prev_end - FROM osm_relation_members_boundaries + FROM osm_admin_relation_members WHERE ST_GeometryType(geometry) = 'ST_LineString' + AND type = 'administrative' AND geometry IS NOT NULL ), diff --git a/images/tiler-imposm/queries/ohm_mviews/non_admin_boundaries_areas.sql b/images/tiler-imposm/queries/ohm_mviews/non_admin_boundaries_areas.sql new file mode 100644 index 00000000..08dde461 --- /dev/null +++ b/images/tiler-imposm/queries/ohm_mviews/non_admin_boundaries_areas.sql @@ -0,0 +1,41 @@ +-- ============================================================================ +-- Create materialized views for non-admin boundaries areas https://github.com/OpenHistoricalMap/issues/issues/1251 +-- ============================================================================ +DROP MATERIALIZED VIEW IF EXISTS mv_non_admin_boundaries_areas_z16_20 CASCADE; + +SELECT create_areas_mview( 'osm_admin_areas', 'mv_non_admin_boundaries_areas_z16_20', 1, 0, 'id, osm_id, type', 'type <> ''administrative''', 'tags->''religion'' AS religion, tags->''denomination'' AS denomination, tags->''timezone'' AS timezone, tags->''utc'' AS utc, tags->''postal_code'' AS postal_code, tags->''ref'' AS ref, tags->''political_division'' AS political_division' ); +SELECT create_area_mview_from_mview('mv_non_admin_boundaries_areas_z16_20','mv_non_admin_boundaries_areas_z13_15', 5, 0.0, NULL); +SELECT create_area_mview_from_mview('mv_non_admin_boundaries_areas_z13_15','mv_non_admin_boundaries_areas_z10_12', 20, 0.0, NULL ); +SELECT create_area_mview_from_mview('mv_non_admin_boundaries_areas_z10_12','mv_non_admin_boundaries_areas_z8_9', 100, 0.0, NULL ); +SELECT create_area_mview_from_mview('mv_non_admin_boundaries_areas_z8_9','mv_non_admin_boundaries_areas_z6_7', 200, 0.0, NULL ); +SELECT create_area_mview_from_mview('mv_non_admin_boundaries_areas_z6_7','mv_non_admin_boundaries_areas_z3_5', 1000, 0.0, NULL ); +SELECT create_area_mview_from_mview('mv_non_admin_boundaries_areas_z3_5','mv_non_admin_boundaries_areas_z0_2', 5000, 0.0, NULL ); + +-- ============================================================================ +-- Centroids views for non-admin boundaries areas +-- ============================================================================ + +SELECT create_points_centroids_mview('mv_non_admin_boundaries_areas_z16_20', 'mv_non_admin_boundaries_centroids_z16_20', NULL); +SELECT create_points_centroids_mview('mv_non_admin_boundaries_areas_z13_15', 'mv_non_admin_boundaries_centroids_z13_15', NULL); +SELECT create_points_centroids_mview('mv_non_admin_boundaries_areas_z10_12', 'mv_non_admin_boundaries_centroids_z10_12', NULL); +SELECT create_points_centroids_mview('mv_non_admin_boundaries_areas_z8_9', 'mv_non_admin_boundaries_centroids_z8_9', NULL); +SELECT create_points_centroids_mview('mv_non_admin_boundaries_areas_z6_7', 'mv_non_admin_boundaries_centroids_z6_7', NULL); +SELECT create_points_centroids_mview('mv_non_admin_boundaries_areas_z3_5', 'mv_non_admin_boundaries_centroids_z3_5', NULL); +SELECT create_points_centroids_mview('mv_non_admin_boundaries_areas_z0_2', 'mv_non_admin_boundaries_centroids_z0_2', NULL); + + +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_areas_z16_20; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_areas_z13_15; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_areas_z10_12; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_areas_z8_9; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_areas_z6_7; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_areas_z3_5; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_areas_z0_2; + +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_centroids_z16_20; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_centroids_z13_15; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_centroids_z10_12; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_centroids_z8_9; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_centroids_z6_7; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_centroids_z3_5; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_non_admin_boundaries_centroids_z0_2; diff --git a/images/tiler-imposm/queries/utils/create_01_areas_mview.sql b/images/tiler-imposm/queries/utils/create_01_areas_mview.sql index 29ab6a74..f9397233 100644 --- a/images/tiler-imposm/queries/utils/create_01_areas_mview.sql +++ b/images/tiler-imposm/queries/utils/create_01_areas_mview.sql @@ -17,6 +17,7 @@ -- min_area DOUBLE PRECISION - Minimum area in m² to include (0 = no filter) -- unique_columns TEXT - Comma-separated columns for unique index (default: 'id, osm_id, type') -- where_filter TEXT - Optional WHERE clause filter (e.g., "type != 'barrier'" or "class NOT IN ('power', 'military')"). NULL = no filter +-- tag_columns TEXT - Optional extra columns from tags (e.g., "tags->'religion' AS religion, tags->'denomination' AS denomination"). NULL = none -- -- Notes: -- - Creates the materialized view using a temporary swap mechanism @@ -25,6 +26,7 @@ -- - where_filter is appended to WHERE clause with AND, so use conditions like "type != 'barrier'" not "AND type != 'barrier'" -- ============================================================================ DROP FUNCTION IF EXISTS create_areas_mview(TEXT, TEXT, DOUBLE PRECISION, DOUBLE PRECISION, TEXT, TEXT); +DROP FUNCTION IF EXISTS create_areas_mview(TEXT, TEXT, DOUBLE PRECISION, DOUBLE PRECISION, TEXT, TEXT, TEXT); CREATE OR REPLACE FUNCTION create_areas_mview( source_table TEXT, @@ -32,7 +34,8 @@ CREATE OR REPLACE FUNCTION create_areas_mview( simplify_tol DOUBLE PRECISION DEFAULT 0, min_area DOUBLE PRECISION DEFAULT 0, unique_columns TEXT DEFAULT 'id, osm_id, type', - where_filter TEXT DEFAULT NULL + where_filter TEXT DEFAULT NULL, + tag_columns TEXT DEFAULT NULL ) RETURNS void AS $$ DECLARE @@ -100,6 +103,11 @@ BEGIN -- Add source column to identify origin (polygon) all_cols := all_cols || ', ''polygon'' AS source'; + -- Add optional tag columns (e.g. "tags->'religion' AS religion, tags->'denomination' AS denomination") + IF tag_columns IS NOT NULL AND tag_columns <> '' THEN + all_cols := all_cols || ', ' || tag_columns; + END IF; + sql_create := format($sql$ CREATE MATERIALIZED VIEW %I AS SELECT diff --git a/images/tiler-imposm/queries/utils/create_generic_mview.sql b/images/tiler-imposm/queries/utils/create_generic_mview.sql index 45de2c2b..a2ed336f 100644 --- a/images/tiler-imposm/queries/utils/create_generic_mview.sql +++ b/images/tiler-imposm/queries/utils/create_generic_mview.sql @@ -39,6 +39,10 @@ DECLARE geom_index_final TEXT := format('idx_%s_geom', mview_name); uid_index_final TEXT := format('idx_%s_uid', mview_name); BEGIN + -- Temporary memory configuration for the view creation + SET LOCAL work_mem = '512MB'; + SET LOCAL maintenance_work_mem = '1GB'; + -- Step 1: Log and drop temp view RAISE NOTICE '==> [START] Creating view: %', mview_name; RAISE NOTICE '==> [DROP TEMP] Dropping tmp view: %', tmp_mview_name; diff --git a/images/tiler-imposm/scripts/create_mviews.sh b/images/tiler-imposm/scripts/create_mviews.sh index 5907eee4..e3b3c0da 100755 --- a/images/tiler-imposm/scripts/create_mviews.sh +++ b/images/tiler-imposm/scripts/create_mviews.sh @@ -85,3 +85,5 @@ execute_sql_file queries/ohm_mviews/routes_01_merge_by_date.sql execute_sql_file queries/ohm_mviews/routes_02_indexed.sql execute_sql_file queries/ohm_mviews/routes_03_mv.sql +## non admin boundaries +execute_sql_file queries/ohm_mviews/non_admin_boundaries_areas.sql diff --git a/images/tiler-imposm/scripts/refresh_mviews.sh b/images/tiler-imposm/scripts/refresh_mviews.sh index f67348a7..48e54d6e 100755 --- a/images/tiler-imposm/scripts/refresh_mviews.sh +++ b/images/tiler-imposm/scripts/refresh_mviews.sh @@ -214,6 +214,27 @@ routes_views=( mv_routes_indexed_z5 ) +no_admin_boundaries_views=( + # areas + mv_non_admin_boundaries_areas_z16_20 + mv_non_admin_boundaries_areas_z13_15 + mv_non_admin_boundaries_areas_z10_12 + mv_non_admin_boundaries_areas_z8_9 + mv_non_admin_boundaries_areas_z6_7 + mv_non_admin_boundaries_areas_z3_5 + mv_non_admin_boundaries_areas_z0_2 + + # centroids + mv_non_admin_boundaries_centroids_z16_20 + mv_non_admin_boundaries_centroids_z13_15 + mv_non_admin_boundaries_centroids_z10_12 + mv_non_admin_boundaries_centroids_z8_9 + mv_non_admin_boundaries_centroids_z6_7 + mv_non_admin_boundaries_centroids_z3_5 + mv_non_admin_boundaries_centroids_z0_2 +) + + refresh_mviews_group "ADMIN_BOUNDARIES_LINES" 60 "${admin_boundaries_lines_views[@]}" & refresh_mviews_group "ADMIN_BOUNDARIES_AREAS_CENTROIDS" 180 "${admin_boundaries_areas_centroids_views[@]}" & refresh_mviews_group "ADMIN_MARITIME_LINES" 300 "${admin_maritime_lines_views[@]}" & @@ -225,3 +246,6 @@ refresh_mviews_group "PLACES" 180 "${places_views[@]}" & refresh_mviews_group "WATER" 180 "${water_views[@]}" & refresh_mviews_group "BUILDINGS" 180 "${buildings_views[@]}" & refresh_mviews_group "ROUTES" 180 "${routes_views[@]}" & + +## This group high demand, so we refresh every 1 hour +refresh_mviews_group "NO_ADMIN_BOUNDARIES" 36000 "${no_admin_boundaries_views[@]}" & \ No newline at end of file diff --git a/images/tiler-server/config/config.template.toml b/images/tiler-server/config/config.template.toml index 1b49e630..3381ba4a 100644 --- a/images/tiler-server/config/config.template.toml +++ b/images/tiler-server/config/config.template.toml @@ -26,7 +26,7 @@ type = "prometheus" name = "osm" type = "mvt_postgis" uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" -max_connections = 150 +max_connections = 120 ###### PROVIDERS_OSM #################################### @@ -40,6 +40,17 @@ uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POS max_connections = 25 ###### PROVIDERS_ADMIN_BOUNDARIES_AREAS +#################################### +## OHM non admin boundaries areas +#################################### + +[[providers]] +name = "non_admin" +type = "mvt_postgis" +uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" +max_connections = 25 + ###### PROVIDERS_NON_ADMIN_BOUNDARIES_AREAS + #################################### ## Natural Earth (ne) providers #################################### @@ -132,6 +143,15 @@ attribution = "OpenHistoricalMap" center = [0.0, 0.0, 0.0] ###### MAPS_ADMIN_BOUNDARIES_AREAS +#################################### +## OHM non admin boundaries areas maps +#################################### +[[maps]] +name = "non_admin" +attribution = "OpenHistoricalMap" +center = [0.0, 0.0, 0.0] + ###### MAPS_NON_ADMIN_BOUNDARIES_AREAS + #################################### ## Natural Earth maps #################################### diff --git a/images/tiler-server/config/providers/non_admin_boundaries_areas.toml b/images/tiler-server/config/providers/non_admin_boundaries_areas.toml new file mode 100644 index 00000000..d698e3d8 --- /dev/null +++ b/images/tiler-server/config/providers/non_admin_boundaries_areas.toml @@ -0,0 +1,264 @@ +[[providers.layers]] +name = "non_admin_boundaries_areas_z0_2" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + admin_level, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + short_name, + official_name, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_areas_z0_2 +WHERE + geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_areas_z3_5" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + admin_level, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_areas_z3_5 +WHERE + geometry && !BBOX! +""" + + +[[providers.layers]] +name = "non_admin_boundaries_areas_z6_7" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + admin_level, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_areas_z6_7 +WHERE + geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_areas_z8_9" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + admin_level, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_areas_z8_9 +WHERE + geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_areas_z10_12" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + admin_level, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_areas_z10_12 +WHERE + geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_areas_z13_15" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + admin_level, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_areas_z13_15 +WHERE + geometry && !BBOX! +""" + + +[[providers.layers]] +name = "non_admin_boundaries_areas_z16_20" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + admin_level, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_areas_z16_20 +WHERE + geometry && !BBOX! +""" + + +#######Maps +[[maps.layers]] +name = "boundaries_areas" +provider_layer = "non_admin.non_admin_boundaries_areas_z0_2" +min_zoom = 0 +max_zoom = 2 + +[[maps.layers]] +name = "boundaries_areas" +provider_layer = "non_admin.non_admin_boundaries_areas_z3_5" +min_zoom = 3 +max_zoom = 5 + +[[maps.layers]] +name = "boundaries_areas" +provider_layer = "non_admin.non_admin_boundaries_areas_z6_7" +min_zoom = 6 +max_zoom = 7 + +[[maps.layers]] +name = "boundaries_areas" +provider_layer = "non_admin.non_admin_boundaries_areas_z8_9" +min_zoom = 8 +max_zoom = 9 + +[[maps.layers]] +name = "boundaries_areas" +provider_layer = "non_admin.non_admin_boundaries_areas_z10_12" +min_zoom = 9 +max_zoom = 10 + +[[maps.layers]] +name = "boundaries_areas" +provider_layer = "non_admin.non_admin_boundaries_areas_z13_15" +min_zoom = 11 +max_zoom = 15 + +[[maps.layers]] +name = "boundaries_areas" +provider_layer = "non_admin.non_admin_boundaries_areas_z16_20" +min_zoom = 16 +max_zoom = 20 diff --git a/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml b/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml new file mode 100644 index 00000000..84b8665b --- /dev/null +++ b/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml @@ -0,0 +1,265 @@ +[[providers.layers]] +name = "non_admin_boundaries_centroid_z0_2" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + admin_level, + name, + type, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + short_name, + official_name, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_centroids_z0_2 +WHERE geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_centroid_z3_5" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + admin_level, + name, + type, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + short_name, + official_name, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_centroids_z3_5 +WHERE geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_centroid_z6_7" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + admin_level, + name, + type, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + short_name, + official_name, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_centroids_z6_7 +WHERE geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_centroid_z8_9" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + admin_level, + name, + type, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + short_name, + official_name, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_centroids_z8_9 +WHERE geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_centroid_z10_12" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + admin_level, + name, + type, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + short_name, + official_name, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_centroids_z10_12 +WHERE geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_centroid_z13_15" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + admin_level, + name, + type, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + short_name, + official_name, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_centroids_z13_15 +WHERE geometry && !BBOX! +""" + +[[providers.layers]] +name = "non_admin_boundaries_centroid_z16_20" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + admin_level, + name, + type, + start_date, + end_date, + area_km2, + start_decdate, + end_decdate, + short_name, + official_name, + religion, + denomination, + timezone, + utc, + postal_code, + ref, + political_division, + {{LENGUAGES}} +FROM + mv_non_admin_boundaries_centroids_z16_20 +WHERE geometry && !BBOX! +""" +#######Maps +[[maps.layers]] +name = "boundaries_centroids" +provider_layer = "non_admin.non_admin_boundaries_centroid_z0_2" +min_zoom = 0 +max_zoom = 2 + +[[maps.layers]] +name = "boundaries_centroids" +provider_layer = "non_admin.non_admin_boundaries_centroid_z3_5" +min_zoom = 3 +max_zoom = 5 + +[[maps.layers]] +name = "boundaries_centroids" +provider_layer = "non_admin.non_admin_boundaries_centroid_z6_7" +min_zoom = 6 +max_zoom = 7 + +[[maps.layers]] +name = "boundaries_centroids" +provider_layer = "non_admin.non_admin_boundaries_centroid_z8_9" +min_zoom = 8 +max_zoom = 9 + +[[maps.layers]] +name = "boundaries_centroids" +provider_layer = "non_admin.non_admin_boundaries_centroid_z10_12" +min_zoom = 10 +max_zoom = 12 + +[[maps.layers]] +name = "boundaries_centroids" +provider_layer = "non_admin.non_admin_boundaries_centroid_z13_15" +min_zoom = 13 +max_zoom = 15 + +[[maps.layers]] +name = "boundaries_centroids" +provider_layer = "non_admin.non_admin_boundaries_centroid_z16_20" +min_zoom = 16 +max_zoom = 20 diff --git a/images/tiler-server/scripts/build_config.py b/images/tiler-server/scripts/build_config.py index 2084f996..f10467f8 100644 --- a/images/tiler-server/scripts/build_config.py +++ b/images/tiler-server/scripts/build_config.py @@ -123,7 +123,16 @@ def process_layer_blocks(raw_content: str, lang_map: dict) -> str: ] } - groups = [provider_osm, provider_ohm_admin_boundary] + provider_ohm_non_admin_boundary = { + "provider_marker": "###### PROVIDERS_NON_ADMIN_BOUNDARIES_AREAS", + "map_marker": "###### MAPS_NON_ADMIN_BOUNDARIES_AREAS", + "providers": [ + "non_admin_boundaries_areas", + "non_admin_boundaries_centroids" + ] + } + + groups = [provider_osm, provider_ohm_admin_boundary, provider_ohm_non_admin_boundary] with open(TEMPLATE_FILE, 'r') as f: template_content = f.read() From 18951559d0c66bc35a262c4fb16d8edbf88715c8 Mon Sep 17 00:00:00 2001 From: "Ruben L. Mendoza" Date: Thu, 19 Feb 2026 12:18:50 -0500 Subject: [PATCH 4/8] Rename provider from osm -> ohm (#700) * Rename provider from osm to ohm * Update traefik to redirect osm provider to ohm tiler provider * Better to call ohm_non_admin --- hetzner/traefik/traefik.template.yml | 20 +++++++++---------- .../tiler-server/config/config.template.toml | 8 ++++---- .../providers/admin_boundaries_centroids.toml | 14 ++++++------- .../providers/admin_boundaries_lines.toml | 14 ++++++------- .../providers/admin_boundaries_maritime.toml | 6 +++--- .../config/providers/amenity_areas.toml | 4 ++-- .../providers/amenity_points_centroids.toml | 4 ++-- .../config/providers/buildings_areas.toml | 4 ++-- .../providers/buildings_points_centroids.toml | 4 ++-- .../config/providers/landuse_areas.toml | 10 +++++----- .../config/providers/landuse_lines.toml | 4 ++-- .../providers/landuse_points_centroids.toml | 10 +++++----- .../providers/non_admin_boundaries_areas.toml | 14 ++++++------- .../non_admin_boundaries_centroids.toml | 14 ++++++------- .../config/providers/other_areas.toml | 8 ++++---- .../config/providers/other_lines.toml | 4 ++-- .../providers/other_points_centroids.toml | 8 ++++---- .../config/providers/place_areas.toml | 2 +- .../providers/place_points_centroids.toml | 8 ++++---- .../config/providers/route_lines.toml | 12 +++++------ .../config/providers/transport_areas.toml | 6 +++--- .../config/providers/transport_lines.toml | 12 +++++------ .../providers/transport_points_centroids.toml | 6 +++--- .../config/providers/water_areas.toml | 14 ++++++------- .../providers/water_areas_centroids.toml | 8 ++++---- .../config/providers/water_lines.toml | 8 ++++---- 26 files changed, 113 insertions(+), 113 deletions(-) diff --git a/hetzner/traefik/traefik.template.yml b/hetzner/traefik/traefik.template.yml index 68357aa1..2a3c212b 100644 --- a/hetzner/traefik/traefik.template.yml +++ b/hetzner/traefik/traefik.template.yml @@ -74,15 +74,15 @@ http: replacement: "https://${1}/ui/search.html" permanent: true - # replace-osm-to-ohm: - # replacePathRegex: - # regex: "^/capabilities/osm\\.json$" - # replacement: "/capabilities/ohm.json" + replace-osm-to-ohm: + replacePathRegex: + regex: "^/capabilities/osm\\.json$" + replacement: "/capabilities/ohm.json" - # replace-osm-tiles-to-ohm: - # replacePathRegex: - # regex: "^/maps/osm/(.*)$" - # replacement: "/maps/ohm/${1}" + replace-osm-tiles-to-ohm: + replacePathRegex: + regex: "^/maps/osm/(.*)$" + replacement: "/maps/ohm/${1}" routers: vtiles-router: @@ -93,8 +93,8 @@ http: middlewares: - secure-headers-allow-iframe # Note: Removed replace-osm-to-ohm middleware because Tegola map is named "osm" - # - replace-osm-to-ohm - # - replace-osm-tiles-to-ohm + - replace-osm-to-ohm + - replace-osm-tiles-to-ohm nominatim-router: rule: Host(`nominatim.{{OHM_DOMAIN}}`) && !PathPrefix(`/ui`) diff --git a/images/tiler-server/config/config.template.toml b/images/tiler-server/config/config.template.toml index 3381ba4a..72ad226f 100644 --- a/images/tiler-server/config/config.template.toml +++ b/images/tiler-server/config/config.template.toml @@ -23,7 +23,7 @@ type = "prometheus" ## OpenHistoricalMap providers #################################### [[providers]] -name = "osm" +name = "ohm" type = "mvt_postgis" uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" max_connections = 120 @@ -45,7 +45,7 @@ max_connections = 25 #################################### [[providers]] -name = "non_admin" +name = "ohm_non_admin" type = "mvt_postgis" uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" max_connections = 25 @@ -129,7 +129,7 @@ max_connections = 25 ## OpenHistoricalMap maps #################################### [[maps]] -name = "osm" +name = "ohm" attribution = "OpenHistoricalMap" center = [-42.31214, 70.00455, 10.0] ###### MAPS_OSM @@ -147,7 +147,7 @@ center = [0.0, 0.0, 0.0] ## OHM non admin boundaries areas maps #################################### [[maps]] -name = "non_admin" +name = "ohm_non_admin" attribution = "OpenHistoricalMap" center = [0.0, 0.0, 0.0] ###### MAPS_NON_ADMIN_BOUNDARIES_AREAS diff --git a/images/tiler-server/config/providers/admin_boundaries_centroids.toml b/images/tiler-server/config/providers/admin_boundaries_centroids.toml index 0b395b1b..5b6d4c66 100644 --- a/images/tiler-server/config/providers/admin_boundaries_centroids.toml +++ b/images/tiler-server/config/providers/admin_boundaries_centroids.toml @@ -175,42 +175,42 @@ WHERE geometry && !BBOX! #######Maps [[maps.layers]] name = "land_ohm_centroids" -provider_layer = "osm.admin_boundaries_centroid_z0_2" +provider_layer = "ohm.admin_boundaries_centroid_z0_2" min_zoom = 0 max_zoom = 2 [[maps.layers]] name = "land_ohm_centroids" -provider_layer = "osm.admin_boundaries_centroid_z3_5" +provider_layer = "ohm.admin_boundaries_centroid_z3_5" min_zoom = 3 max_zoom = 5 [[maps.layers]] name = "land_ohm_centroids" -provider_layer = "osm.admin_boundaries_centroid_z6_7" +provider_layer = "ohm.admin_boundaries_centroid_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "land_ohm_centroids" -provider_layer = "osm.admin_boundaries_centroid_z8_9" +provider_layer = "ohm.admin_boundaries_centroid_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "land_ohm_centroids" -provider_layer = "osm.admin_boundaries_centroid_z10_12" +provider_layer = "ohm.admin_boundaries_centroid_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "land_ohm_centroids" -provider_layer = "osm.admin_boundaries_centroid_z13_15" +provider_layer = "ohm.admin_boundaries_centroid_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "land_ohm_centroids" -provider_layer = "osm.admin_boundaries_centroid_z16_20" +provider_layer = "ohm.admin_boundaries_centroid_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/admin_boundaries_lines.toml b/images/tiler-server/config/providers/admin_boundaries_lines.toml index 7ad67efc..90335210 100644 --- a/images/tiler-server/config/providers/admin_boundaries_lines.toml +++ b/images/tiler-server/config/providers/admin_boundaries_lines.toml @@ -148,42 +148,42 @@ WHERE #######Maps [[maps.layers]] name = "land_ohm_lines" -provider_layer = "osm.admin_boundaries_lines_z0_2" +provider_layer = "ohm.admin_boundaries_lines_z0_2" min_zoom = 0 max_zoom = 2 [[maps.layers]] name = "land_ohm_lines" -provider_layer = "osm.admin_boundaries_lines_z3_5" +provider_layer = "ohm.admin_boundaries_lines_z3_5" min_zoom = 3 max_zoom = 5 [[maps.layers]] name = "land_ohm_lines" -provider_layer = "osm.admin_boundaries_lines_z6_7" +provider_layer = "ohm.admin_boundaries_lines_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "land_ohm_lines" -provider_layer = "osm.admin_boundaries_lines_z8_9" +provider_layer = "ohm.admin_boundaries_lines_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "land_ohm_lines" -provider_layer = "osm.admin_boundaries_lines_z10_12" +provider_layer = "ohm.admin_boundaries_lines_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "land_ohm_lines" -provider_layer = "osm.admin_boundaries_lines_z13_15" +provider_layer = "ohm.admin_boundaries_lines_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "land_ohm_lines" -provider_layer = "osm.admin_boundaries_lines_z16_20" +provider_layer = "ohm.admin_boundaries_lines_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/admin_boundaries_maritime.toml b/images/tiler-server/config/providers/admin_boundaries_maritime.toml index 2b9d1670..e40ac87b 100644 --- a/images/tiler-server/config/providers/admin_boundaries_maritime.toml +++ b/images/tiler-server/config/providers/admin_boundaries_maritime.toml @@ -76,18 +76,18 @@ WHERE #######Maps [[maps.layers]] name = "land_ohm_maritime" -provider_layer = "osm.admin_lines_z0_5" +provider_layer = "ohm.admin_lines_z0_5" min_zoom = 0 max_zoom = 5 [[maps.layers]] name = "land_ohm_maritime" -provider_layer = "osm.admin_lines_z6_9" +provider_layer = "ohm.admin_lines_z6_9" min_zoom = 6 max_zoom = 9 [[maps.layers]] name = "land_ohm_maritime" -provider_layer = "osm.admin_lines_z10_15" +provider_layer = "ohm.admin_lines_z10_15" min_zoom = 10 max_zoom = 12 diff --git a/images/tiler-server/config/providers/amenity_areas.toml b/images/tiler-server/config/providers/amenity_areas.toml index 25945b03..66fe6480 100644 --- a/images/tiler-server/config/providers/amenity_areas.toml +++ b/images/tiler-server/config/providers/amenity_areas.toml @@ -46,12 +46,12 @@ WHERE #######Maps [[maps.layers]] name = "amenity_areas" -provider_layer = "osm.amenity_areas_z14_15" +provider_layer = "ohm.amenity_areas_z14_15" min_zoom = 14 max_zoom = 15 [[maps.layers]] name = "amenity_areas" -provider_layer = "osm.amenity_areas_z16_20" +provider_layer = "ohm.amenity_areas_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/amenity_points_centroids.toml b/images/tiler-server/config/providers/amenity_points_centroids.toml index ec1b255b..ddea2032 100644 --- a/images/tiler-server/config/providers/amenity_points_centroids.toml +++ b/images/tiler-server/config/providers/amenity_points_centroids.toml @@ -46,12 +46,12 @@ WHERE #######Maps [[maps.layers]] name = "amenity_points_centroids" -provider_layer = "osm.amenity_points_centroids_z14_15" +provider_layer = "ohm.amenity_points_centroids_z14_15" min_zoom = 14 max_zoom = 15 [[maps.layers]] name = "amenity_points_centroids" -provider_layer = "osm.amenity_points_centroids_z16_20" +provider_layer = "ohm.amenity_points_centroids_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/buildings_areas.toml b/images/tiler-server/config/providers/buildings_areas.toml index 453303aa..238f0238 100644 --- a/images/tiler-server/config/providers/buildings_areas.toml +++ b/images/tiler-server/config/providers/buildings_areas.toml @@ -49,12 +49,12 @@ WHERE #######Maps [[maps.layers]] name = "buildings" -provider_layer = "osm.buildings_z14_15" +provider_layer = "ohm.buildings_z14_15" min_zoom = 14 max_zoom = 15 [[maps.layers]] name = "buildings" -provider_layer = "osm.buildings_z16_20" +provider_layer = "ohm.buildings_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/buildings_points_centroids.toml b/images/tiler-server/config/providers/buildings_points_centroids.toml index 03961d99..f402c52f 100644 --- a/images/tiler-server/config/providers/buildings_points_centroids.toml +++ b/images/tiler-server/config/providers/buildings_points_centroids.toml @@ -48,12 +48,12 @@ WHERE [[maps.layers]] name = "buildings_points_centroids" -provider_layer = "osm.buildings_points_centroids_z14_15" +provider_layer = "ohm.buildings_points_centroids_z14_15" min_zoom = 14 max_zoom = 15 [[maps.layers]] name = "buildings_points_centroids" -provider_layer = "osm.buildings_points_centroids_z16_20" +provider_layer = "ohm.buildings_points_centroids_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/landuse_areas.toml b/images/tiler-server/config/providers/landuse_areas.toml index bf170f39..e75d0120 100644 --- a/images/tiler-server/config/providers/landuse_areas.toml +++ b/images/tiler-server/config/providers/landuse_areas.toml @@ -128,30 +128,30 @@ WHERE [[maps.layers]] name = "landuse_areas" -provider_layer = "osm.landuse_areas_z6_7" +provider_layer = "ohm.landuse_areas_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "landuse_areas" -provider_layer = "osm.landuse_areas_z8_9" +provider_layer = "ohm.landuse_areas_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "landuse_areas" -provider_layer = "osm.landuse_areas_z10_12" +provider_layer = "ohm.landuse_areas_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "landuse_areas" -provider_layer = "osm.landuse_areas_z13_15" +provider_layer = "ohm.landuse_areas_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "landuse_areas" -provider_layer = "osm.landuse_areas_z16_20" +provider_layer = "ohm.landuse_areas_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/landuse_lines.toml b/images/tiler-server/config/providers/landuse_lines.toml index c3a2a904..4e147803 100644 --- a/images/tiler-server/config/providers/landuse_lines.toml +++ b/images/tiler-server/config/providers/landuse_lines.toml @@ -47,13 +47,13 @@ WHERE [[maps.layers]] name = "landuse_lines" -provider_layer = "osm.landuse_lines_z14_15" +provider_layer = "ohm.landuse_lines_z14_15" min_zoom = 14 max_zoom = 15 [[maps.layers]] name = "landuse_lines" -provider_layer = "osm.landuse_lines_z16_20" +provider_layer = "ohm.landuse_lines_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/landuse_points_centroids.toml b/images/tiler-server/config/providers/landuse_points_centroids.toml index e8433884..5d92795e 100644 --- a/images/tiler-server/config/providers/landuse_points_centroids.toml +++ b/images/tiler-server/config/providers/landuse_points_centroids.toml @@ -124,30 +124,30 @@ WHERE [[maps.layers]] name = "landuse_points_centroids" -provider_layer = "osm.landuse_points_centroids_z6_7" +provider_layer = "ohm.landuse_points_centroids_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "landuse_points_centroids" -provider_layer = "osm.landuse_points_centroids_z8_9" +provider_layer = "ohm.landuse_points_centroids_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "landuse_points_centroids" -provider_layer = "osm.landuse_points_centroids_z10_12" +provider_layer = "ohm.landuse_points_centroids_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "landuse_points_centroids" -provider_layer = "osm.landuse_points_centroids_z13_15" +provider_layer = "ohm.landuse_points_centroids_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "landuse_points_centroids" -provider_layer = "osm.landuse_points_centroids_z16_20" +provider_layer = "ohm.landuse_points_centroids_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/non_admin_boundaries_areas.toml b/images/tiler-server/config/providers/non_admin_boundaries_areas.toml index d698e3d8..58c3595a 100644 --- a/images/tiler-server/config/providers/non_admin_boundaries_areas.toml +++ b/images/tiler-server/config/providers/non_admin_boundaries_areas.toml @@ -223,42 +223,42 @@ WHERE #######Maps [[maps.layers]] name = "boundaries_areas" -provider_layer = "non_admin.non_admin_boundaries_areas_z0_2" +provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z0_2" min_zoom = 0 max_zoom = 2 [[maps.layers]] name = "boundaries_areas" -provider_layer = "non_admin.non_admin_boundaries_areas_z3_5" +provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z3_5" min_zoom = 3 max_zoom = 5 [[maps.layers]] name = "boundaries_areas" -provider_layer = "non_admin.non_admin_boundaries_areas_z6_7" +provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "boundaries_areas" -provider_layer = "non_admin.non_admin_boundaries_areas_z8_9" +provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "boundaries_areas" -provider_layer = "non_admin.non_admin_boundaries_areas_z10_12" +provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z10_12" min_zoom = 9 max_zoom = 10 [[maps.layers]] name = "boundaries_areas" -provider_layer = "non_admin.non_admin_boundaries_areas_z13_15" +provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z13_15" min_zoom = 11 max_zoom = 15 [[maps.layers]] name = "boundaries_areas" -provider_layer = "non_admin.non_admin_boundaries_areas_z16_20" +provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml b/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml index 84b8665b..e5b2b87d 100644 --- a/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml +++ b/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml @@ -224,42 +224,42 @@ WHERE geometry && !BBOX! #######Maps [[maps.layers]] name = "boundaries_centroids" -provider_layer = "non_admin.non_admin_boundaries_centroid_z0_2" +provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z0_2" min_zoom = 0 max_zoom = 2 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "non_admin.non_admin_boundaries_centroid_z3_5" +provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z3_5" min_zoom = 3 max_zoom = 5 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "non_admin.non_admin_boundaries_centroid_z6_7" +provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "non_admin.non_admin_boundaries_centroid_z8_9" +provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "non_admin.non_admin_boundaries_centroid_z10_12" +provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "non_admin.non_admin_boundaries_centroid_z13_15" +provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "non_admin.non_admin_boundaries_centroid_z16_20" +provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/other_areas.toml b/images/tiler-server/config/providers/other_areas.toml index 21568d9d..9ad172af 100644 --- a/images/tiler-server/config/providers/other_areas.toml +++ b/images/tiler-server/config/providers/other_areas.toml @@ -97,25 +97,25 @@ WHERE [[maps.layers]] name = "other_areas" -provider_layer = "osm.other_areas_z8_9" +provider_layer = "ohm.other_areas_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "other_areas" -provider_layer = "osm.other_areas_z10_12" +provider_layer = "ohm.other_areas_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "other_areas" -provider_layer = "osm.other_areas_z13_15" +provider_layer = "ohm.other_areas_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "other_areas" -provider_layer = "osm.other_areas_z16_20" +provider_layer = "ohm.other_areas_z16_20" min_zoom = 16 max_zoom = 20 \ No newline at end of file diff --git a/images/tiler-server/config/providers/other_lines.toml b/images/tiler-server/config/providers/other_lines.toml index 03da853e..6182840e 100644 --- a/images/tiler-server/config/providers/other_lines.toml +++ b/images/tiler-server/config/providers/other_lines.toml @@ -46,12 +46,12 @@ WHERE #######Maps [[maps.layers]] name = "other_lines" -provider_layer = "osm.other_lines_z14_15" +provider_layer = "ohm.other_lines_z14_15" min_zoom = 14 max_zoom = 15 [[maps.layers]] name = "other_lines" -provider_layer = "osm.other_lines_z16_20" +provider_layer = "ohm.other_lines_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/other_points_centroids.toml b/images/tiler-server/config/providers/other_points_centroids.toml index 5ba0d084..88f7bb86 100644 --- a/images/tiler-server/config/providers/other_points_centroids.toml +++ b/images/tiler-server/config/providers/other_points_centroids.toml @@ -98,24 +98,24 @@ WHERE [[maps.layers]] name = "other_points_centroids" -provider_layer = "osm.other_points_centroids_z8_9" +provider_layer = "ohm.other_points_centroids_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "other_points_centroids" -provider_layer = "osm.other_points_centroids_z10_12" +provider_layer = "ohm.other_points_centroids_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "other_points_centroids" -provider_layer = "osm.other_points_centroids_z13_15" +provider_layer = "ohm.other_points_centroids_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "other_points_centroids" -provider_layer = "osm.other_points_centroids_z16_20" +provider_layer = "ohm.other_points_centroids_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/place_areas.toml b/images/tiler-server/config/providers/place_areas.toml index 44ed82de..1fac59c6 100644 --- a/images/tiler-server/config/providers/place_areas.toml +++ b/images/tiler-server/config/providers/place_areas.toml @@ -26,6 +26,6 @@ WHERE #######Maps [[maps.layers]] name = "place_areas" -provider_layer = "osm.place_areas" +provider_layer = "ohm.place_areas" min_zoom = 14 max_zoom = 20 diff --git a/images/tiler-server/config/providers/place_points_centroids.toml b/images/tiler-server/config/providers/place_points_centroids.toml index 4bcb9893..a0f8b7df 100644 --- a/images/tiler-server/config/providers/place_points_centroids.toml +++ b/images/tiler-server/config/providers/place_points_centroids.toml @@ -101,24 +101,24 @@ WHERE #######Maps [[maps.layers]] name = "place_points_centroids" -provider_layer = "osm.place_points_centroids_z3_5" +provider_layer = "ohm.place_points_centroids_z3_5" min_zoom = 0 max_zoom = 2 [[maps.layers]] name = "place_points_centroids" -provider_layer = "osm.place_points_centroids_z3_5" +provider_layer = "ohm.place_points_centroids_z3_5" min_zoom = 3 max_zoom = 5 [[maps.layers]] name = "place_points_centroids" -provider_layer = "osm.place_points_centroids_z6_10" +provider_layer = "ohm.place_points_centroids_z6_10" min_zoom = 6 max_zoom = 10 [[maps.layers]] name = "place_points_centroids" -provider_layer = "osm.place_points_centroids_z11_20" +provider_layer = "ohm.place_points_centroids_z11_20" min_zoom = 11 max_zoom = 20 diff --git a/images/tiler-server/config/providers/route_lines.toml b/images/tiler-server/config/providers/route_lines.toml index 883f4398..a7afdb09 100644 --- a/images/tiler-server/config/providers/route_lines.toml +++ b/images/tiler-server/config/providers/route_lines.toml @@ -440,36 +440,36 @@ WHERE geometry && !BBOX! #######Maps [[maps.layers]] name = "route_lines" -provider_layer = "osm.route_lines_z5" +provider_layer = "ohm.route_lines_z5" min_zoom = 5 max_zoom = 5 [[maps.layers]] name = "route_lines" -provider_layer = "osm.route_lines_z6_7" +provider_layer = "ohm.route_lines_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "route_lines" -provider_layer = "osm.route_lines_z8_9" +provider_layer = "ohm.route_lines_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "route_lines" -provider_layer = "osm.route_lines_z10_12" +provider_layer = "ohm.route_lines_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "route_lines" -provider_layer = "osm.route_lines_z13_15" +provider_layer = "ohm.route_lines_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "route_lines" -provider_layer = "osm.route_lines_z16_20" +provider_layer = "ohm.route_lines_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/transport_areas.toml b/images/tiler-server/config/providers/transport_areas.toml index 6ee9188b..71bcb1b9 100644 --- a/images/tiler-server/config/providers/transport_areas.toml +++ b/images/tiler-server/config/providers/transport_areas.toml @@ -72,18 +72,18 @@ WHERE #######Maps [[maps.layers]] name = "transport_areas" -provider_layer = "osm.transport_areas_z10_12" +provider_layer = "ohm.transport_areas_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "transport_areas" -provider_layer = "osm.transport_areas_z13_15" +provider_layer = "ohm.transport_areas_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "transport_areas" -provider_layer = "osm.transport_areas_z16_20" +provider_layer = "ohm.transport_areas_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/transport_lines.toml b/images/tiler-server/config/providers/transport_lines.toml index 7ca1fd81..f1cea34e 100644 --- a/images/tiler-server/config/providers/transport_lines.toml +++ b/images/tiler-server/config/providers/transport_lines.toml @@ -207,36 +207,36 @@ WHERE #######Maps [[maps.layers]] name = "transport_lines" -provider_layer = "osm.transport_lines_z5" +provider_layer = "ohm.transport_lines_z5" min_zoom = 5 max_zoom = 5 [[maps.layers]] name = "transport_lines" -provider_layer = "osm.transport_lines_z6_7" +provider_layer = "ohm.transport_lines_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "transport_lines" -provider_layer = "osm.transport_lines_z8_9" +provider_layer = "ohm.transport_lines_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "transport_lines" -provider_layer = "osm.transport_lines_z10_12" +provider_layer = "ohm.transport_lines_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "transport_lines" -provider_layer = "osm.transport_lines_z13_15" +provider_layer = "ohm.transport_lines_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "transport_lines" -provider_layer = "osm.transport_lines_z16_20" +provider_layer = "ohm.transport_lines_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/transport_points_centroids.toml b/images/tiler-server/config/providers/transport_points_centroids.toml index f0ffdbae..db151a35 100644 --- a/images/tiler-server/config/providers/transport_points_centroids.toml +++ b/images/tiler-server/config/providers/transport_points_centroids.toml @@ -72,18 +72,18 @@ WHERE #######Maps [[maps.layers]] name = "transport_points_centroids" -provider_layer = "osm.transport_points_centroids_z10_12" +provider_layer = "ohm.transport_points_centroids_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "transport_points_centroids" -provider_layer = "osm.transport_points_centroids_z13_15" +provider_layer = "ohm.transport_points_centroids_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "transport_points_centroids" -provider_layer = "osm.transport_points_centroids_z16_20" +provider_layer = "ohm.transport_points_centroids_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/water_areas.toml b/images/tiler-server/config/providers/water_areas.toml index 767800ed..cc4270a7 100644 --- a/images/tiler-server/config/providers/water_areas.toml +++ b/images/tiler-server/config/providers/water_areas.toml @@ -162,42 +162,42 @@ WHERE #######Maps [[maps.layers]] name = "water_areas" -provider_layer = "osm.water_areas_z0_2" +provider_layer = "ohm.water_areas_z0_2" min_zoom = 0 max_zoom = 2 [[maps.layers]] name = "water_areas" -provider_layer = "osm.water_areas_z3_5" +provider_layer = "ohm.water_areas_z3_5" min_zoom = 3 max_zoom = 5 [[maps.layers]] name = "water_areas" -provider_layer = "osm.water_areas_z6_7" +provider_layer = "ohm.water_areas_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "water_areas" -provider_layer = "osm.water_areas_z8_9" +provider_layer = "ohm.water_areas_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "water_areas" -provider_layer = "osm.water_areas_z10_12" +provider_layer = "ohm.water_areas_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "water_areas" -provider_layer = "osm.water_areas_z13_15" +provider_layer = "ohm.water_areas_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "water_areas" -provider_layer = "osm.water_areas_z16_20" +provider_layer = "ohm.water_areas_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/water_areas_centroids.toml b/images/tiler-server/config/providers/water_areas_centroids.toml index 9d5b54c2..8b519c80 100644 --- a/images/tiler-server/config/providers/water_areas_centroids.toml +++ b/images/tiler-server/config/providers/water_areas_centroids.toml @@ -94,24 +94,24 @@ WHERE [[maps.layers]] name = "water_areas_centroids" -provider_layer = "osm.water_areas_centroid_z8_9" +provider_layer = "ohm.water_areas_centroid_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "water_areas_centroids" -provider_layer = "osm.water_areas_centroid_z10_12" +provider_layer = "ohm.water_areas_centroid_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "water_areas_centroids" -provider_layer = "osm.water_areas_centroid_z13_15" +provider_layer = "ohm.water_areas_centroid_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "water_areas_centroids" -provider_layer = "osm.water_areas_centroid_z16_20" +provider_layer = "ohm.water_areas_centroid_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/water_lines.toml b/images/tiler-server/config/providers/water_lines.toml index 0750120c..98c9af32 100644 --- a/images/tiler-server/config/providers/water_lines.toml +++ b/images/tiler-server/config/providers/water_lines.toml @@ -100,24 +100,24 @@ WHERE #######Maps [[maps.layers]] name = "water_lines" -provider_layer = "osm.water_lines_z8_9" +provider_layer = "ohm.water_lines_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "water_lines" -provider_layer = "osm.water_lines_z10_12" +provider_layer = "ohm.water_lines_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "water_lines" -provider_layer = "osm.water_lines_z13_15" +provider_layer = "ohm.water_lines_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "water_lines" -provider_layer = "osm.water_lines_z16_20" +provider_layer = "ohm.water_lines_z16_20" min_zoom = 16 max_zoom = 20 From ce016ef733641170035f96347c5d907b302ee44d Mon Sep 17 00:00:00 2001 From: "Ruben L. Mendoza" Date: Thu, 19 Feb 2026 15:23:00 -0500 Subject: [PATCH 5/8] Rename osm to ohm vtiles source name (#701) * Rename provider from osm to ohm * Update traefik to redirect osm provider to ohm tiler provider * Better to call ohm_non_admin * Rename ohm_non_admin to ohm_other_boundaries --- images/tiler-server/config/config.template.toml | 4 ++-- .../providers/non_admin_boundaries_areas.toml | 14 +++++++------- .../providers/non_admin_boundaries_centroids.toml | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/images/tiler-server/config/config.template.toml b/images/tiler-server/config/config.template.toml index 72ad226f..61a31ee2 100644 --- a/images/tiler-server/config/config.template.toml +++ b/images/tiler-server/config/config.template.toml @@ -45,7 +45,7 @@ max_connections = 25 #################################### [[providers]] -name = "ohm_non_admin" +name = "ohm_other_boundaries" type = "mvt_postgis" uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" max_connections = 25 @@ -147,7 +147,7 @@ center = [0.0, 0.0, 0.0] ## OHM non admin boundaries areas maps #################################### [[maps]] -name = "ohm_non_admin" +name = "ohm_other_boundaries" attribution = "OpenHistoricalMap" center = [0.0, 0.0, 0.0] ###### MAPS_NON_ADMIN_BOUNDARIES_AREAS diff --git a/images/tiler-server/config/providers/non_admin_boundaries_areas.toml b/images/tiler-server/config/providers/non_admin_boundaries_areas.toml index 58c3595a..296319f7 100644 --- a/images/tiler-server/config/providers/non_admin_boundaries_areas.toml +++ b/images/tiler-server/config/providers/non_admin_boundaries_areas.toml @@ -223,42 +223,42 @@ WHERE #######Maps [[maps.layers]] name = "boundaries_areas" -provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z0_2" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_areas_z0_2" min_zoom = 0 max_zoom = 2 [[maps.layers]] name = "boundaries_areas" -provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z3_5" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_areas_z3_5" min_zoom = 3 max_zoom = 5 [[maps.layers]] name = "boundaries_areas" -provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z6_7" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_areas_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "boundaries_areas" -provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z8_9" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_areas_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "boundaries_areas" -provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z10_12" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_areas_z10_12" min_zoom = 9 max_zoom = 10 [[maps.layers]] name = "boundaries_areas" -provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z13_15" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_areas_z13_15" min_zoom = 11 max_zoom = 15 [[maps.layers]] name = "boundaries_areas" -provider_layer = "ohm_non_admin.non_admin_boundaries_areas_z16_20" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_areas_z16_20" min_zoom = 16 max_zoom = 20 diff --git a/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml b/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml index e5b2b87d..46c421f9 100644 --- a/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml +++ b/images/tiler-server/config/providers/non_admin_boundaries_centroids.toml @@ -224,42 +224,42 @@ WHERE geometry && !BBOX! #######Maps [[maps.layers]] name = "boundaries_centroids" -provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z0_2" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_centroid_z0_2" min_zoom = 0 max_zoom = 2 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z3_5" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_centroid_z3_5" min_zoom = 3 max_zoom = 5 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z6_7" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_centroid_z6_7" min_zoom = 6 max_zoom = 7 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z8_9" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_centroid_z8_9" min_zoom = 8 max_zoom = 9 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z10_12" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_centroid_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z13_15" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_centroid_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] name = "boundaries_centroids" -provider_layer = "ohm_non_admin.non_admin_boundaries_centroid_z16_20" +provider_layer = "ohm_other_boundaries.non_admin_boundaries_centroid_z16_20" min_zoom = 16 max_zoom = 20 From bc7b5977a470fa66946f89861b956cd17e30c1e1 Mon Sep 17 00:00:00 2001 From: Eric Theise Date: Wed, 25 Feb 2026 12:59:18 -0800 Subject: [PATCH 6/8] Release overpass-turbo v2.1.11 (#704) * Release overpass-turbo v2.1.11 * No need to change the bucket name --------- Co-authored-by: Rub21 --- .github/workflows/frontend-overpass.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/frontend-overpass.yaml b/.github/workflows/frontend-overpass.yaml index e33d5046..de80317c 100644 --- a/.github/workflows/frontend-overpass.yaml +++ b/.github/workflows/frontend-overpass.yaml @@ -15,7 +15,7 @@ jobs: steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 + uses: styfle/cancel-workflow-action@0.13.0 with: access_token: ${{ github.token }} @@ -36,15 +36,15 @@ jobs: CLOUDFRONT_DISTRIBUTION_ID: E24URY7SKM2LDD - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: "20.x" - name: Checkout overpass-turbo repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: OpenHistoricalMap/overpass-turbo - ref: 7a9c4bb794b2367970c052fbfb73dc7254e13455 + ref: a64d500abc82744613b77bbb362e2cee98648d59 path: overpass-turbo - name: Enable Corepack @@ -63,7 +63,7 @@ jobs: working-directory: overpass-turbo - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v6 with: python-version: "3.10" From 12c71f9559396d20ffbf5a210390d029725ead6c Mon Sep 17 00:00:00 2001 From: "Ruben L. Mendoza" Date: Thu, 26 Feb 2026 07:38:15 -0500 Subject: [PATCH 7/8] Vtiles improvements - communication_lines, transport_lines and route_lines (#703) * Include street and communication layers in vtiles * Update imposm config to import data to routes and communication multilines * update sql scripts * Update imposm configs * Update tiler compose * update comunication * script to reimport * update to reimport tables * Update * Create a Mview for transport lines * Update communication mview * Add highway in routes_line layer * Update columns for communication * Update communication props * Display communication from zoom 10 on * Do not returm empty values for communitacion_lines layer * Add relation attribute * Display the way itseff too. * Merge results in only one feature in case the attributes are the same * Update branch naem to generate docker images --- .github/workflows/chartpress.yaml | 16 +- .gitignore | 5 + compose/tiler.yml | 91 +- images/tiler-imposm/config/imposm3.json | 2046 ----------------- .../config/layers/communication_lines.json | 148 ++ .../layers/communication_multilines.json | 152 ++ .../config/layers/relation_members.json | 68 - .../tiler-imposm/config/layers/relations.json | 56 - .../config/layers/route_lines.json | 5 + .../config/layers/route_multilines.json | 6 + .../config/layers/street_multilines.json | 140 ++ .../ohm_mviews/admin_boundaries_lines.sql | 2 +- .../queries/ohm_mviews/communication.sql | 106 + .../ohm_mviews/routes_01_merge_by_date.sql | 56 +- .../queries/ohm_mviews/routes_02_indexed.sql | 6 +- .../queries/ohm_mviews/routes_03_mv.sql | 1 + .../queries/ohm_mviews/transport_lines.sql | 288 ++- images/tiler-imposm/scripts/create_mviews.sh | 3 +- images/tiler-imposm/scripts/refresh_mviews.sh | 7 + images/tiler-imposm/scripts/reimport_layer.sh | 62 + .../config/providers/communication_lines.toml | 134 ++ .../config/providers/route_lines.toml | 6 + .../config/providers/transport_lines.toml | 12 +- images/tiler-server/scripts/build_config.py | 3 +- 24 files changed, 1088 insertions(+), 2331 deletions(-) delete mode 100644 images/tiler-imposm/config/imposm3.json create mode 100644 images/tiler-imposm/config/layers/communication_lines.json create mode 100644 images/tiler-imposm/config/layers/communication_multilines.json delete mode 100644 images/tiler-imposm/config/layers/relation_members.json delete mode 100644 images/tiler-imposm/config/layers/relations.json create mode 100644 images/tiler-imposm/config/layers/street_multilines.json create mode 100644 images/tiler-imposm/queries/ohm_mviews/communication.sql create mode 100755 images/tiler-imposm/scripts/reimport_layer.sh create mode 100644 images/tiler-server/config/providers/communication_lines.toml diff --git a/.github/workflows/chartpress.yaml b/.github/workflows/chartpress.yaml index 4be2054b..268ee223 100644 --- a/.github/workflows/chartpress.yaml +++ b/.github/workflows/chartpress.yaml @@ -4,7 +4,7 @@ on: branches: - 'main' - 'staging' - - 'configs_cgimap' + - 'communication_and_street' jobs: build: runs-on: ubuntu-22.04 @@ -71,7 +71,7 @@ jobs: OHM_SLACK_WEBHOOK_URL: ${{ secrets.OHM_SLACK_WEBHOOK_URL }} ################ Staging secrets ################ - name: Staging - substitute secrets - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/configs_cgimap' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/communication_and_street' uses: bluwy/substitute-string-action@v1 with: _input-file: 'values.staging.template.yaml' @@ -189,14 +189,14 @@ jobs: PRODUCTION_OPENSTREETMAP_AUTH_SECRET: ${{ secrets.PRODUCTION_OPENSTREETMAP_AUTH_SECRET }} - name: AWS Credentials - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/configs_cgimap' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/communication_and_street' uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Setup Kubectl and Helm Dependencies - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/configs_cgimap' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/communication_and_street' run: | sudo pip install awscli --ignore-installed six sudo curl -L -o /usr/bin/kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.17.7/2020-07-08/bin/linux/amd64/kubectl @@ -210,22 +210,22 @@ jobs: helm version - name: Update kube-config staging - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/configs_cgimap' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/communication_and_street' run: aws eks --region us-east-1 update-kubeconfig --name osmseed-staging - name: Update kube-config prod if: github.ref == 'refs/heads/main' run: aws eks --region us-east-1 update-kubeconfig --name osmseed-production-v2 - name: Add Helm repository - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/configs_cgimap' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/communication_and_street' run: | helm repo add osm-seed https://osm-seed.github.io/osm-seed-chart/ helm repo update - name: Install helm dependencies for - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/configs_cgimap' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/communication_and_street' run: cd ohm && helm dep up # Staging - name: Staging - helm deploy - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/configs_cgimap' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/communication_and_street' run: helm upgrade --install staging --wait ohm/ -f values.staging.yaml -f ohm/values.yaml # Production - name: Production - helm deploy diff --git a/.gitignore b/.gitignore index f5dbe850..5ab9a7d6 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,8 @@ hetzner/*/.envs.*.production hetzner/traefik/cloudflare-ips.txt hetzner/traefik/traefik.yml .vscode/ +imposm3.json + +cachedir_reimport/ +config_reimport.json +imposm3_reimport.json \ No newline at end of file diff --git a/compose/tiler.yml b/compose/tiler.yml index 2673e16d..61df8d65 100644 --- a/compose/tiler.yml +++ b/compose/tiler.yml @@ -1,27 +1,29 @@ services: db: - image: ohm-tiler-db:v1 + image: rub21/ohm-tiler-db:v1 + container_name: db build: context: ../images/tiler-db dockerfile: Dockerfile ports: - - "5432:5432" - # volumes: - # - ../data/tiler-db-data2:/var/lib/postgresql/data + - "54321:5432" + volumes: + - tiler_pgdata:/var/lib/postgresql/data env_file: - ../envs/.env.tiler restart: always networks: - - tiler_network + - ohm_network imposm: - image: rub21/tiler-imposm:v70 + image: rub21/tiler-imposm:v1 + container_name: imposm build: context: ../images/tiler-imposm dockerfile: Dockerfile volumes: - ../images/tiler-imposm:/osm - - ../hetzner:/hetzner + - tiler_imposm_data:/mnt/data command: - sh - -c @@ -29,10 +31,11 @@ services: env_file: - ../envs/.env.tiler networks: - - tiler_network + - ohm_network tiler: - image: rub21/tiler-server:v73 + image: rub21/tiler-server:v1 + container_name: tiler build: context: ../images/tiler-server dockerfile: Dockerfile @@ -45,39 +48,47 @@ services: - ../envs/.env.tiler restart: always networks: - - tiler_network + - ohm_network - tiler-cache: - image: rub21/tiler-cache:v2 - build: - context: ../images/tiler-cache - dockerfile: Dockerfile - volumes: - - ../images/tiler-cache:/app - env_file: - - ../envs/.env.tiler - restart: always - networks: - - tiler_network + # tiler-cache: + # image: rub21/tiler-cache:v2 + # build: + # context: ../images/tiler-cache + # dockerfile: Dockerfile + # volumes: + # - ../images/tiler-cache:/app + # env_file: + # - ../envs/.env.tiler + # restart: always + # networks: + # - ohm_network - tiler-monitor: - image: rub21/tiler-monitor:v1 - build: - context: ../images/tiler-monitor - dockerfile: Dockerfile - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ../images/tiler-monitor:/app - - ../hetzner:/app/hetzner - environment: - - DOCKER_CONFIG_ENVIRONMENT=staging - env_file: - - ../envs/.env.tiler - stdin_open: true - tty: true + # tiler-monitor: + # image: rub21/tiler-monitor:v1 + # build: + # context: ../images/tiler-monitor + # dockerfile: Dockerfile + # volumes: + # - /var/run/docker.sock:/var/run/docker.sock + # - ../images/tiler-monitor:/app + # - ../hetzner:/app/hetzner + # environment: + # - DOCKER_CONFIG_ENVIRONMENT=staging + # env_file: + # - ../envs/.env.tiler + # stdin_open: true + # tty: true networks: - tiler_network: - driver: bridge - \ No newline at end of file + ohm_network: + external: true + +volumes: + tiler_pgdata: + driver: local + name: tiler_db + + tiler_imposm_data: + driver: local + name: tiler_imposm diff --git a/images/tiler-imposm/config/imposm3.json b/images/tiler-imposm/config/imposm3.json deleted file mode 100644 index c1502c87..00000000 --- a/images/tiler-imposm/config/imposm3.json +++ /dev/null @@ -1,2046 +0,0 @@ -{ - "tags": { - "load_all": true, - "exclude": [ - "created_by", - "source", - "source:datetime" - ] - }, - "generalized_tables": { - "transport_multilines_z5": { - "source": "transport_multilines_z6", - "sql_filter": null, - "tolerance": 200 - }, - "transport_multilines_z6": { - "source": "transport_multilines_z7", - "sql_filter": null, - "tolerance": 150 - }, - "transport_multilines_z7": { - "source": "transport_multilines_z8", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail')", - "tolerance": 100 - }, - "transport_multilines_z8": { - "source": "transport_multilines_z9", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail', 'secondary', 'secondary_link')", - "tolerance": 50 - }, - "transport_multilines_z9": { - "source": "transport_multilines_z10_11", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link')", - "tolerance": 25 - }, - "transport_multilines_z10_11": { - "source": "transport_multilines_z12_13", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link')", - "tolerance": 15 - }, - "transport_multilines_z12_13": { - "source": "transport_multilines", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'light_rail', 'preserved', 'proposed', 'tram', 'funicular', 'monorail', 'taxiway', 'runway', 'raceway', 'residential', 'service', 'unclassified') OR class IN ('railway', 'route')", - "tolerance": 5 - }, - "water_lines_z8_9": { - "source": "water_lines", - "sql_filter": "type IN ('river', 'canal')", - "tolerance": 100 - }, - "water_lines_z10_12": { - "source": "water_lines", - "sql_filter": "type IN ('river', 'canal', 'cliff', 'dam')", - "tolerance": 20 - }, - "water_lines_z13_15": { - "source": "water_lines", - "sql_filter": "type IN ('river', 'canal', 'cliff', 'dam', 'stream')", - "tolerance": 5 - }, - "water_lines_z16_20": { - "source": "water_lines", - "sql_filter": "type IN ('river', 'canal', 'cliff', 'dam', 'stream', 'ditch', 'drain')" - }, - "water_areas_z0_2": { - "source": "water_areas_z3_5", - "sql_filter": "type IN ('water', 'riverbank') AND area > 100000000", - "tolerance": 5000 - }, - "water_areas_z3_5": { - "source": "water_areas_z6_7", - "sql_filter": "area > 50000000", - "tolerance": 1000 - }, - "water_areas_z6_7": { - "source": "water_areas_z8_9", - "sql_filter": "area > 1000000", - "tolerance": 200 - }, - "water_areas_z8_9": { - "source": "water_areas_z10_12", - "sql_filter": "type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') AND area > 10000", - "tolerance": 100 - }, - "water_areas_z10_12": { - "source": "water_areas_z13_15", - "sql_filter": "type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank')", - "tolerance": 20 - }, - "water_areas_z13_15": { - "source": "water_areas", - "sql_filter": "type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank', 'dock')", - "tolerance": 5 - }, - "admin_areas_z0_2": { - "source": "admin_areas", - "tolerance": 5000, - "sql_filter": "admin_level IN (1,2)" - }, - "admin_areas_z3_5": { - "source": "admin_areas", - "tolerance": 1000, - "sql_filter": "admin_level IN (1,2,3,4)" - }, - "admin_areas_z6_7": { - "source": "admin_areas", - "tolerance": 200, - "sql_filter": "admin_level IN (1,2,3,4,5,6)" - }, - "admin_areas_z8_9": { - "source": "admin_areas", - "tolerance": 100, - "sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9)" - }, - "admin_areas_z10_12": { - "source": "admin_areas", - "tolerance": 20, - "sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10)" - }, - "admin_areas_z13_15": { - "source": "admin_areas", - "tolerance": 5, - "sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10)" - }, - "admin_areas_z16_20": { - "source": "admin_areas", - "sql_filter": "admin_level IN (1,2,3,4,5,6,7,8,9,10)" - }, - "admin_lines_z0_5": { - "source": "admin_lines_z6_9", - "sql_filter": "maritime='yes'", - "tolerance": 2000 - }, - "admin_lines_z6_9": { - "source": "admin_lines_z10_15", - "sql_filter": "maritime='yes'", - "tolerance": 500 - }, - "admin_lines_z10_15": { - "source": "admin_lines_z16_20", - "sql_filter": "maritime='yes'", - "tolerance": 10 - }, - "admin_lines_z16_20": { - "source": "admin_lines", - "sql_filter": "maritime='yes'" - }, - "transport_lines_z5": { - "source": "transport_lines_z6", - "sql_filter": null, - "tolerance": 200 - }, - "transport_lines_z6": { - "source": "transport_lines_z7", - "sql_filter": null, - "tolerance": 150 - }, - "transport_lines_z7": { - "source": "transport_lines_z8", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail')", - "tolerance": 100 - }, - "transport_lines_z8": { - "source": "transport_lines_z9", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail', 'secondary', 'secondary_link')", - "tolerance": 50 - }, - "transport_lines_z9": { - "source": "transport_lines_z10_11", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link')", - "tolerance": 25 - }, - "transport_lines_z10_11": { - "source": "transport_lines_z12_13", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link')", - "tolerance": 15 - }, - "transport_lines_z12_13": { - "source": "transport_lines", - "sql_filter": "type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'construction', 'primary', 'primary_link', 'rail', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'miniature', 'narrow_gauge', 'dismantled', 'abandoned', 'disused', 'razed', 'light_rail', 'preserved', 'proposed', 'tram', 'funicular', 'monorail', 'taxiway', 'runway', 'raceway', 'residential', 'service', 'unclassified') OR class IN ('railway', 'route')", - "tolerance": 5 - }, - "landuse_areas_z3_5": { - "source": "landuse_areas_z6_7", - "sql_filter": "ST_Area(geometry)>50000000", - "tolerance": 1000 - }, - "landuse_areas_z6_7": { - "source": "landuse_areas_z8_9", - "sql_filter": "ST_Area(geometry)>1000000", - "tolerance": 200 - }, - "landuse_areas_z8_9": { - "source": "landuse_areas_z10_12", - "sql_filter": "ST_Area(geometry)>1000000 AND type IN ('forest', 'wood', 'nature reserve', 'nature_reserve', 'military')", - "tolerance": 100 - }, - "landuse_areas_z10_12": { - "source": "landuse_areas_z13_15", - "tolerance": 20 - }, - "landuse_areas_z13_15": { - "source": "landuse_areas", - "tolerance": 5 - } - }, - "tables": { - "transport_multilines": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "boolint", - "name": "tunnel", - "key": "tunnel" - }, - { - "type": "boolint", - "name": "bridge", - "key": "bridge" - }, - { - "type": "direction", - "name": "oneway", - "key": "oneway" - }, - { - "type": "string", - "name": "ref", - "key": "ref" - }, - { - "type": "wayzorder", - "name": "z_order", - "key": "layer" - }, - { - "type": "string", - "name": "access", - "key": "access" - }, - { - "type": "string", - "name": "service", - "key": "service" - }, - { - "type": "string", - "name": "ford", - "key": "ford" - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "string", - "name": "electrified", - "key": "electrified" - }, - { - "type": "string", - "name": "highspeed", - "key": "highspeed" - }, - { - "type": "string", - "name": "usage", - "key": "usage" - }, - { - "type": "string", - "name": "railway", - "key": "railway" - }, - { - "type": "string", - "name": "aeroway", - "key": "aeroway" - }, - { - "type": "string", - "name": "highway", - "key": "highway" - }, - { - "type": "string", - "name": "route", - "key": "route" - }, - { - "key": "type", - "name": "relation_type", - "type": "string" - }, - { - "name": "member", - "type": "member_id" - }, - { - "type": "hstore_tags", - "name": "me_tags", - "from_member": true - } - ], - "type": "relation_member", - "filters": { - "reject": { - "area": ["yes"] - } - }, - "mappings": { - "railway": { - "mapping": { - "railway": [ - "__any__" - ] - } - }, - "highway": { - "mapping": { - "highway": [ - "__any__" - ] - } - } - } - }, - "amenity_points": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "point", - "mapping": { - "amenity": [ - "__any__" - ] - } - }, - "buildings": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "string", - "name": "height", - "key": "height" - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "area", - "name": "area", - "key": null - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "polygon", - "mapping": { - "building": [ - "__any__" - ] - } - }, - "water_lines": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "string", - "name": "bridge", - "key": "bridge" - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "linestring", - "mapping": { - "waterway": [ - "__any__" - ], - "barrier": [ - "ditch" - ], - "natural": [ - "cliff" - ] - } - }, - "relations": { - "type": "relation", - "fields": [ - { - "name": "osm_id", - "type": "id" - }, - { - "key": "type", - "name": "type", - "type": "string" - }, - { - "key": "name", - "name": "name", - "type": "string" - }, - { - "key": "start_date", - "name": "start_date", - "type": "string" - }, - { - "key": "end_date", - "name": "end_date", - "type": "string" - }, - { - "name": "tags", - "type": "hstore_tags" - } - ], - "mapping": { - "__any__": [ - "__any__" - ] - }, - "filters": { - "reject": { - "boundary": ["administrative"] - } - } - }, - "water_areas": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "area", - "name": "area", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "polygon", - "mapping": { - "waterway": [ - "__any__" - ], - "landuse": [ - "basin", - "reservoir" - ], - "natural": [ - "water" - ] - } - }, - "other_points": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "point", - "mappings": { - "barrier": { - "mapping": { - "barrier": [ - "__any__" - ] - } - }, - "historic": { - "mapping": { - "historic": [ - "__any__" - ] - } - }, - "man_made": { - "mapping": { - "man_made": [ - "__any__" - ] - } - }, - "power": { - "mapping": { - "power": [ - "__any__" - ] - } - }, - "military": { - "mapping": { - "military": [ - "__any__" - ] - } - }, - "tourism": { - "mapping": { - "tourism": [ - "__any__" - ] - } - }, - "shop": { - "mapping": { - "shop": [ - "__any__" - ] - } - }, - "craft": { - "mapping": { - "craft": [ - "__any__" - ] - } - } - } - }, - "admin_areas": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "integer", - "name": "admin_level", - "key": "admin_level" - }, - { - "type": "boolint", - "name": "has_label", - "key": false - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "area", - "name": "area", - "key": null - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "polygon", - "mapping": { - "boundary": [ - "administrative" - ] - } - }, - "admin_lines": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "integer", - "name": "admin_level", - "key": "admin_level" - }, - { - "type": "string", - "name": "maritime", - "key": "maritime" - }, - { - "type": "boolint", - "name": "has_label", - "key": false - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "linestring", - "mapping": { - "boundary": [ - "administrative" - ] - } - }, - "buildings_points": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "point", - "mapping": { - "building": [ - "__any__" - ] - } - }, - "other_lines": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "linestring", - "mappings": { - "barrier": { - "mapping": { - "barrier": [ - "__any__" - ] - } - }, - "historic": { - "mapping": { - "historic": [ - "__any__" - ] - } - }, - "man_made": { - "mapping": { - "man_made": [ - "__any__" - ] - } - }, - "power": { - "mapping": { - "power": [ - "__any__" - ] - } - }, - "military": { - "mapping": { - "military": [ - "__any__" - ] - } - } - } - }, - "other_areas": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "area", - "name": "area", - "key": null - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "polygon", - "mappings": { - "barrier": { - "mapping": { - "barrier": [ - "__any__" - ] - } - }, - "historic": { - "mapping": { - "historic": [ - "__any__" - ] - } - }, - "man_made": { - "mapping": { - "man_made": [ - "__any__" - ] - } - }, - "power": { - "mapping": { - "power": [ - "__any__" - ] - } - }, - "military": { - "mapping": { - "military": [ - "__any__" - ] - } - } - } - }, - "transport_points": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "string", - "name": "ref", - "key": "ref" - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "point", - "mappings": { - "railway": { - "mapping": { - "railway": [ - "__any__" - ] - } - }, - "highway": { - "mapping": { - "highway": [ - "__any__" - ] - } - }, - "aeroway": { - "mapping": { - "aeroway": [ - "__any__" - ] - } - }, - "route": { - "mapping": { - "route": [ - "__any__" - ] - } - } - } - }, - "amenity_areas": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "area", - "name": "area", - "key": null - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "polygon", - "mapping": { - "amenity": [ - "__any__" - ] - } - }, - "place_points": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "integer", - "name": "population", - "key": "population" - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "point", - "mapping": { - "place": [ - "__any__" - ] - } - }, - "relation_members": { - "type": "relation_member", - "fields": [ - { - "name": "osm_id", - "type": "id" - }, - { - "name": "member", - "type": "member_id" - }, - { - "name": "index", - "type": "member_index" - }, - { - "name": "role", - "type": "member_role" - }, - { - "name": "type", - "type": "member_type" - }, - { - "name": "geometry", - "type": "geometry" - }, - { - "name": "relname", - "key": "name", - "type": "string" - }, - { - "key": "start_date", - "name": "start_date", - "type": "string" - }, - { - "key": "end_date", - "name": "end_date", - "type": "string" - }, - { - "name": "name", - "key": "name", - "type": "string", - "from_member": true - } - ], - "mapping": { - "__any__": [ - "__any__" - ] - } - }, - "relation_members_routes": { - "type": "relation_member", - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "key": "route", - "name": "route", - "type": "string" - }, - { - "key": "ref", - "name": "ref", - "type": "string" - }, - { - "key": "network", - "name": "network", - "type": "string" - }, - { - "key": "direction", - "name": "direction", - "type": "string" - }, - { - "key": "operator", - "name": "operator", - "type": "string" - }, - { - "key": "state", - "name": "state", - "type": "string" - }, - { - "key": "symbol", - "name": "symbol", - "type": "string" - }, - { - "key": "distance", - "name": "distance", - "type": "string" - }, - { - "key": "roundtrip", - "name": "roundtrip", - "type": "string" - }, - { - "key": "interval", - "name": "interval", - "type": "string" - }, - { - "key": "duration", - "name": "duration", - "type": "string" - }, - { - "key": "tourism", - "name": "tourism", - "type": "string" - }, - { - "key": "start_date", - "name": "start_date", - "type": "string" - }, - { - "key": "end_date", - "name": "end_date", - "type": "string" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - }, - { - "name": "geometry", - "type": "geometry", - "key": null - }, - { - "name": "member", - "type": "member_id" - }, - { - "type": "hstore_tags", - "name": "me_tags", - "from_member": true - }, - { - "name": "me_name", - "key": "name", - "type": "string", - "from_member": true - } - ], - "mapping": { - "route": [ - "__any__" - ] - } - }, - "transport_lines": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "boolint", - "name": "tunnel", - "key": "tunnel" - }, - { - "type": "boolint", - "name": "bridge", - "key": "bridge" - }, - { - "type": "direction", - "name": "oneway", - "key": "oneway" - }, - { - "type": "string", - "name": "ref", - "key": "ref" - }, - { - "type": "wayzorder", - "name": "z_order", - "key": "layer" - }, - { - "type": "string", - "name": "access", - "key": "access" - }, - { - "type": "string", - "name": "service", - "key": "service" - }, - { - "type": "string", - "name": "ford", - "key": "ford" - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "string", - "name": "electrified", - "key": "electrified" - }, - { - "type": "string", - "name": "highspeed", - "key": "highspeed" - }, - { - "type": "string", - "name": "usage", - "key": "usage" - }, - { - "type": "string", - "name": "railway", - "key": "railway" - }, - { - "type": "string", - "name": "aeroway", - "key": "aeroway" - }, - { - "type": "string", - "name": "highway", - "key": "highway" - }, - { - "type": "string", - "name": "route", - "key": "route" - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "linestring", - "filters": { - "reject": { - "area": ["yes"] - } - }, - "mappings": { - "railway": { - "mapping": { - "railway": [ - "__any__" - ] - } - }, - "highway": { - "mapping": { - "highway": [ - "__any__" - ] - } - }, - "aeroway": { - "mapping": { - "aeroway": [ - "__any__" - ] - } - }, - "route": { - "mapping": { - "route": [ - "__any__" - ] - } - } - } - }, - "transport_areas": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "area", - "name": "area", - "key": null - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "polygon", - "mappings": { - "rail": { - "mapping": { - "railway": [ - "__any__" - ] - } - }, - "highway": { - "mapping": { - "highway": [ - "__any__" - ] - } - }, - "aeroway": { - "mapping": { - "aeroway": [ - "__any__" - ] - } - }, - "route": { - "mapping": { - "route": [ - "__any__" - ] - } - } - } - }, - "relations_boundaries": { - "type": "relation", - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "integer", - "name": "admin_level", - "key": "admin_level" - }, - { - "key": "start_date", - "name": "start_date", - "type": "string" - }, - { - "key": "end_date", - "name": "end_date", - "type": "string" - }, - { - "type": "boolint", - "name": "has_label", - "key": false - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "mapping": { - "boundary": [ - "administrative" - ] - } - }, - "relation_members_boundaries": { - "type": "relation_member", - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "integer", - "name": "admin_level", - "key": "admin_level" - }, - { - "key": "start_date", - "name": "start_date", - "type": "string" - }, - { - "key": "end_date", - "name": "end_date", - "type": "string" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - }, - { - "name": "geometry", - "type": "geometry" - }, - { - "name": "member", - "type": "member_id" - }, - { - "name": "me_maritime", - "type": "string", - "key": "maritime", - "from_member": true - }, - { - "type": "hstore_tags", - "name": "me_tags", - "from_member": true - }, - { - "name": "me_name", - "key": "name", - "type": "string", - "from_member": true - } - ], - "mapping": { - "boundary": [ - "administrative" - ] - } - }, - "landuse_lines": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "linestring", - "filters": { - "reject": { - "area": ["yes"], - "natural": ["coastline"], - "boundary": ["administrative"] - } - }, - "mappings": { - "landuse": { - "mapping": { - "landuse": [ - "__any__" - ] - } - }, - "leisure": { - "mapping": { - "leisure": [ - "__any__" - ] - } - }, - "natural": { - "mapping": { - "natural": [ - "__any__" - ] - } - } - } - }, - "landuse_areas": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "area", - "name": "area", - "key": null - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "polygon", - "mappings": { - "landuse": { - "mapping": { - "landuse": [ - "__any__" - ] - } - }, - "leisure": { - "mapping": { - "leisure": [ - "__any__" - ] - } - }, - "natural": { - "mapping": { - "natural": [ - "__any__" - ] - }, - "exclude": [ - "water" - ] - } - } - }, - "landuse_points": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "area", - "name": "area", - "key": null - }, - { - "type": "mapping_key", - "name": "class", - "key": null - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "point", - "mappings": { - "landuse": { - "mapping": { - "landuse": [ - "__any__" - ] - } - }, - "leisure": { - "mapping": { - "leisure": [ - "__any__" - ] - } - }, - "natural": { - "mapping": { - "natural": [ - "__any__" - ] - } - } - } - }, - "place_areas": { - "fields": [ - { - "type": "id", - "name": "osm_id", - "key": null - }, - { - "type": "geometry", - "name": "geometry", - "key": null - }, - { - "type": "string", - "name": "name", - "key": "name" - }, - { - "type": "mapping_value", - "name": "type", - "key": null - }, - { - "type": "integer", - "name": "population", - "key": "population" - }, - { - "type": "string", - "name": "start_date", - "key": "start_date" - }, - { - "type": "string", - "name": "end_date", - "key": "end_date" - }, - { - "type": "area", - "name": "area", - "key": null - }, - { - "type": "hstore_tags", - "name": "tags", - "key": null - } - ], - "type": "polygon", - "mapping": { - "place": [ - "__any__" - ] - } - } - } -} \ No newline at end of file diff --git a/images/tiler-imposm/config/layers/communication_lines.json b/images/tiler-imposm/config/layers/communication_lines.json new file mode 100644 index 00000000..aa5a100a --- /dev/null +++ b/images/tiler-imposm/config/layers/communication_lines.json @@ -0,0 +1,148 @@ +{ + "tags": { + "load_all": true, + "exclude": [ + "created_by", + "source", + "source:datetime" + ] + }, + "generalized_tables": {}, + "tables": { + "communication_lines": { + "fields": [ + { + "type": "id", + "name": "osm_id", + "key": null + }, + { + "type": "geometry", + "name": "geometry", + "key": null + }, + { + "type": "string", + "name": "name", + "key": "name" + }, + { + "type": "mapping_value", + "name": "type", + "key": null + }, + { + "type": "string", + "name": "start_date", + "key": "start_date" + }, + { + "type": "string", + "name": "end_date", + "key": "end_date" + }, + { + "type": "string", + "name": "communication_telephone", + "key": "communication:telephone" + }, + { + "type": "string", + "name": "communication_telegraph", + "key": "communication:telegraph" + }, + { + "type": "string", + "name": "communication_internet", + "key": "communication:internet" + }, + { + "type": "string", + "name": "communication_cable_television", + "key": "communication:cable_television" + }, + { + "type": "string", + "name": "communication_television", + "key": "communication:television" + }, + { + "type": "string", + "name": "communication_radio", + "key": "communication:radio" + }, + { + "type": "string", + "name": "communication_microwave", + "key": "communication:microwave" + }, + { + "type": "string", + "name": "communication_bos", + "key": "communication:bos" + }, + { + "type": "string", + "name": "communication_mobile_phone", + "key": "communication:mobile_phone" + }, + { + "type": "string", + "name": "communication_satellite", + "key": "communication:satellite" + }, + { + "type": "string", + "name": "communication_amateur_radio", + "key": "communication:amateur_radio" + }, + { + "type": "string", + "name": "communication_optical", + "key": "communication:optical" + }, + { + "type": "string", + "name": "communication_space", + "key": "communication:space" + }, + { + "type": "string", + "name": "communication_gsm_r", + "key": "communication:gsm-r" + }, + { + "type": "string", + "name": "telecom", + "key": "telecom" + }, + { + "type": "string", + "name": "operator", + "key": "operator" + }, + { + "type": "string", + "name": "location", + "key": "location" + }, + { + "type": "string", + "name": "layer", + "key": "layer" + }, + { + "type": "hstore_tags", + "name": "tags", + "key": null + } + ], + "type": "linestring", + "mapping": { + "communication": [ + "__any__" + ] + } + } + } +} diff --git a/images/tiler-imposm/config/layers/communication_multilines.json b/images/tiler-imposm/config/layers/communication_multilines.json new file mode 100644 index 00000000..90680b11 --- /dev/null +++ b/images/tiler-imposm/config/layers/communication_multilines.json @@ -0,0 +1,152 @@ +{ + "tags": { + "load_all": true, + "exclude": [ + "created_by", + "source", + "source:datetime" + ] + }, + "generalized_tables": {}, + "tables": { + "communication_multilines": { + "type": "relation_member", + "fields": [ + { + "type": "id", + "name": "osm_id", + "key": null + }, + { + "type": "geometry", + "name": "geometry", + "key": null + }, + { + "type": "string", + "name": "name", + "key": "name" + }, + { + "type": "mapping_value", + "name": "type", + "key": null + }, + { + "type": "string", + "name": "start_date", + "key": "start_date" + }, + { + "type": "string", + "name": "end_date", + "key": "end_date" + }, + { + "type": "string", + "name": "communication_telephone", + "key": "communication:telephone" + }, + { + "type": "string", + "name": "communication_telegraph", + "key": "communication:telegraph" + }, + { + "type": "string", + "name": "communication_internet", + "key": "communication:internet" + }, + { + "type": "string", + "name": "communication_cable_television", + "key": "communication:cable_television" + }, + { + "type": "string", + "name": "communication_television", + "key": "communication:television" + }, + { + "type": "string", + "name": "communication_radio", + "key": "communication:radio" + }, + { + "type": "string", + "name": "communication_microwave", + "key": "communication:microwave" + }, + { + "type": "string", + "name": "communication_bos", + "key": "communication:bos" + }, + { + "type": "string", + "name": "communication_mobile_phone", + "key": "communication:mobile_phone" + }, + { + "type": "string", + "name": "communication_satellite", + "key": "communication:satellite" + }, + { + "type": "string", + "name": "communication_amateur_radio", + "key": "communication:amateur_radio" + }, + { + "type": "string", + "name": "communication_optical", + "key": "communication:optical" + }, + { + "type": "string", + "name": "communication_space", + "key": "communication:space" + }, + { + "type": "string", + "name": "communication_gsm_r", + "key": "communication:gsm-r" + }, + { + "type": "string", + "name": "telecom", + "key": "telecom" + }, + { + "type": "string", + "name": "operator", + "key": "operator" + }, + { + "type": "string", + "name": "location", + "key": "location" + }, + { + "type": "string", + "name": "layer", + "key": "layer" + }, + { + "type": "hstore_tags", + "name": "tags", + "key": null + }, + { + "name": "member", + "type": "member_id" + } + ], + "mapping": { + "communication": [ + "__any__" + ] + } + } + } +} diff --git a/images/tiler-imposm/config/layers/relation_members.json b/images/tiler-imposm/config/layers/relation_members.json deleted file mode 100644 index 92f96b38..00000000 --- a/images/tiler-imposm/config/layers/relation_members.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "tags": { - "load_all": true, - "exclude": [ - "created_by", - "source", - "source:datetime" - ] - }, - "generalized_tables": {}, - "tables": { - "relation_members": { - "type": "relation_member", - "fields": [ - { - "name": "osm_id", - "type": "id" - }, - { - "name": "member", - "type": "member_id" - }, - { - "name": "index", - "type": "member_index" - }, - { - "name": "role", - "type": "member_role" - }, - { - "name": "type", - "type": "member_type" - }, - { - "name": "geometry", - "type": "geometry" - }, - { - "name": "relname", - "key": "name", - "type": "string" - }, - { - "key": "start_date", - "name": "start_date", - "type": "string" - }, - { - "key": "end_date", - "name": "end_date", - "type": "string" - }, - { - "name": "name", - "key": "name", - "type": "string", - "from_member": true - } - ], - "mapping": { - "__any__": [ - "__any__" - ] - } - } - } -} diff --git a/images/tiler-imposm/config/layers/relations.json b/images/tiler-imposm/config/layers/relations.json deleted file mode 100644 index b3ad20e9..00000000 --- a/images/tiler-imposm/config/layers/relations.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "tags": { - "load_all": true, - "exclude": [ - "created_by", - "source", - "source:datetime" - ] - }, - "generalized_tables": {}, - "tables": { - "relations": { - "type": "relation", - "fields": [ - { - "name": "osm_id", - "type": "id" - }, - { - "key": "type", - "name": "type", - "type": "string" - }, - { - "key": "name", - "name": "name", - "type": "string" - }, - { - "key": "start_date", - "name": "start_date", - "type": "string" - }, - { - "key": "end_date", - "name": "end_date", - "type": "string" - }, - { - "name": "tags", - "type": "hstore_tags" - } - ], - "mapping": { - "__any__": [ - "__any__" - ] - }, - "filters": { - "reject": { - "boundary": ["administrative"] - } - } - } - } -} diff --git a/images/tiler-imposm/config/layers/route_lines.json b/images/tiler-imposm/config/layers/route_lines.json index ee628d77..b98fda6d 100644 --- a/images/tiler-imposm/config/layers/route_lines.json +++ b/images/tiler-imposm/config/layers/route_lines.json @@ -67,6 +67,11 @@ "name": "end_date", "type": "string" }, + { + "key": "highway", + "name": "highway", + "type": "string" + }, { "type": "hstore_tags", "name": "tags", diff --git a/images/tiler-imposm/config/layers/route_multilines.json b/images/tiler-imposm/config/layers/route_multilines.json index 3d23c29d..a178ea37 100644 --- a/images/tiler-imposm/config/layers/route_multilines.json +++ b/images/tiler-imposm/config/layers/route_multilines.json @@ -91,6 +91,12 @@ "key": "name", "type": "string", "from_member": true + }, + { + "name": "me_highway", + "key": "highway", + "type": "string", + "from_member": true } ], "mapping": { diff --git a/images/tiler-imposm/config/layers/street_multilines.json b/images/tiler-imposm/config/layers/street_multilines.json new file mode 100644 index 00000000..9ec493fd --- /dev/null +++ b/images/tiler-imposm/config/layers/street_multilines.json @@ -0,0 +1,140 @@ +{ + "tags": { + "load_all": true, + "exclude": [ + "created_by", + "source", + "source:datetime" + ] + }, + "generalized_tables": {}, + "tables": { + "street_multilines": { + "type": "relation_member", + "fields": [ + { + "type": "id", + "name": "osm_id", + "key": null + }, + { + "type": "geometry", + "name": "geometry", + "key": null + }, + { + "type": "mapping_value", + "name": "type", + "key": null + }, + { + "type": "string", + "name": "name", + "key": "name" + }, + { + "type": "boolint", + "name": "tunnel", + "key": "tunnel" + }, + { + "type": "boolint", + "name": "bridge", + "key": "bridge" + }, + { + "type": "direction", + "name": "oneway", + "key": "oneway" + }, + { + "type": "string", + "name": "ref", + "key": "ref" + }, + { + "type": "wayzorder", + "name": "z_order", + "key": "layer" + }, + { + "type": "string", + "name": "access", + "key": "access" + }, + { + "type": "string", + "name": "service", + "key": "service" + }, + { + "type": "string", + "name": "ford", + "key": "ford" + }, + { + "type": "mapping_key", + "name": "class", + "key": null + }, + { + "type": "string", + "name": "electrified", + "key": "electrified" + }, + { + "type": "string", + "name": "highspeed", + "key": "highspeed" + }, + { + "type": "string", + "name": "usage", + "key": "usage" + }, + { + "type": "string", + "name": "railway", + "key": "railway" + }, + { + "type": "string", + "name": "aeroway", + "key": "aeroway" + }, + { + "type": "string", + "name": "highway", + "key": "highway" + }, + { + "type": "string", + "name": "route", + "key": "route" + }, + { + "type": "string", + "name": "start_date", + "key": "start_date" + }, + { + "type": "string", + "name": "end_date", + "key": "end_date" + }, + { + "type": "hstore_tags", + "name": "tags", + "key": null + }, + { + "name": "member", + "type": "member_id" + } + ], + "mapping": { + "type": ["street"] + } + } + } +} diff --git a/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_lines.sql b/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_lines.sql index 04fc5542..31cc3a7f 100644 --- a/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_lines.sql +++ b/images/tiler-imposm/queries/ohm_mviews/admin_boundaries_lines.sql @@ -199,7 +199,7 @@ SELECT log_notice('STEP 2.3: Creating additional indexes for query performance') CREATE INDEX IF NOT EXISTS osm_admin_relation_members_type_idx ON osm_admin_relation_members (type); CREATE INDEX IF NOT EXISTS osm_admin_lines_type_idx ON osm_admin_lines (type); -CREATE INDEX IF NOT EXISTS osm_relation_members_role_idx ON osm_admin_relation_members (role); +CREATE INDEX IF NOT EXISTS osm_admin_relation_members_role_idx ON osm_admin_relation_members (role); CREATE INDEX IF NOT EXISTS osm_admin_relation_members_linestring_idx ON osm_admin_relation_members (admin_level, member, type) diff --git a/images/tiler-imposm/queries/ohm_mviews/communication.sql b/images/tiler-imposm/queries/ohm_mviews/communication.sql new file mode 100644 index 00000000..62ca8fbc --- /dev/null +++ b/images/tiler-imposm/queries/ohm_mviews/communication.sql @@ -0,0 +1,106 @@ +-- ============================================================================ +-- Create materialized views for communication lines +-- Combines osm_communication_lines (ways) and osm_communication_multilines +-- (relation members) into unified views at different zoom levels. +-- ============================================================================ + +-- ============================================================================ +-- Unified view: merge lines + multilines into a single source +-- TODO, Do we need to add name_lcale columns? +-- ============================================================================ +DROP VIEW IF EXISTS mv_communication_z16_20 CASCADE; +CREATE VIEW mv_communication_z16_20 AS + -- Ways (simple linestrings) + SELECT + id, + osm_id, + geometry, + NULLIF(name, '') AS name, + type, + NULLIF(start_date, '') AS start_date, + NULLIF(end_date, '') AS end_date, + isodatetodecimaldate(pad_date(start_date::TEXT, 'start')::TEXT, FALSE) AS start_decdate, + isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE) AS end_decdate, + NULLIF(communication_telephone, '') AS communication_telephone, + NULLIF(communication_telegraph, '') AS communication_telegraph, + NULLIF(communication_internet, '') AS communication_internet, + NULLIF(communication_cable_television, '') AS communication_cable_television, + NULLIF(communication_television, '') AS communication_television, + NULLIF(communication_radio, '') AS communication_radio, -- TODO, Do communication:radio usually apply in points, but old objects have it in lines. https://es.wikipedia.org/wiki/Radio_por_cable + NULLIF(communication_microwave, '') AS communication_microwave, + NULLIF(communication_bos, '') AS communication_bos, + NULLIF(communication_mobile_phone, '') AS communication_mobile_phone, + NULLIF(communication_satellite, '') AS communication_satellite, + NULLIF(communication_amateur_radio, '') AS communication_amateur_radio, + NULLIF(communication_optical, '') AS communication_optical, + NULLIF(communication_space, '') AS communication_space, + NULLIF(communication_gsm_r, '') AS communication_gsm_r, + NULLIF(telecom, '') AS telecom, + NULLIF(operator, '') AS operator, + NULLIF(location, '') AS location, + NULLIF(layer, '') AS layer, + tags, + 'line' AS source_type + FROM osm_communication_lines + WHERE geometry IS NOT NULL + + UNION ALL + + -- Relation members (multilinestrings) + SELECT + id, + ABS(osm_id) AS osm_id, + geometry, + NULLIF(name, '') AS name, + type, + NULLIF(start_date, '') AS start_date, + NULLIF(end_date, '') AS end_date, + isodatetodecimaldate(pad_date(start_date::TEXT, 'start')::TEXT, FALSE) AS start_decdate, + isodatetodecimaldate(pad_date(end_date::TEXT, 'end')::TEXT, FALSE) AS end_decdate, + NULLIF(communication_telephone, '') AS communication_telephone, + NULLIF(communication_telegraph, '') AS communication_telegraph, + NULLIF(communication_internet, '') AS communication_internet, + NULLIF(communication_cable_television, '') AS communication_cable_television, + NULLIF(communication_television, '') AS communication_television, + NULLIF(communication_radio, '') AS communication_radio, -- + NULLIF(communication_microwave, '') AS communication_microwave, + NULLIF(communication_bos, '') AS communication_bos, + NULLIF(communication_mobile_phone, '') AS communication_mobile_phone, + NULLIF(communication_satellite, '') AS communication_satellite, + NULLIF(communication_amateur_radio, '') AS communication_amateur_radio, + NULLIF(communication_optical, '') AS communication_optical, + NULLIF(communication_space, '') AS communication_space, + NULLIF(communication_gsm_r, '') AS communication_gsm_r, + NULLIF(telecom, '') AS telecom, + NULLIF(operator, '') AS operator, + NULLIF(location, '') AS location, + NULLIF(layer, '') AS layer, + tags, + 'relation' AS source_type + FROM osm_communication_multilines + WHERE geometry IS NOT NULL + AND ST_GeometryType(geometry) IN ('ST_LineString', 'ST_MultiLineString'); + + +-- ============================================================================ +-- Zoom 14-15: Slight simplification (5m tolerance) +-- ============================================================================ +SELECT create_mview_line_from_mview( + 'mv_communication_z16_20', + 'mv_communication_z13_15', + 5 +); + +-- ============================================================================ +-- Zoom 10-13: More simplification (20m tolerance) +-- ============================================================================ +SELECT create_mview_line_from_mview( + 'mv_communication_z13_15', + 'mv_communication_z10_12', + 20 +); + +-- Refresh views +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_communication_z16_20; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_communication_z13_15; +-- REFRESH MATERIALIZED VIEW CONCURRENTLY mv_communication_z10_12; diff --git a/images/tiler-imposm/queries/ohm_mviews/routes_01_merge_by_date.sql b/images/tiler-imposm/queries/ohm_mviews/routes_01_merge_by_date.sql index 3fb83c60..16eb61ac 100644 --- a/images/tiler-imposm/queries/ohm_mviews/routes_01_merge_by_date.sql +++ b/images/tiler-imposm/queries/ohm_mviews/routes_01_merge_by_date.sql @@ -120,7 +120,8 @@ WITH union_sources AS ( member::bigint AS way_id, osm_id, name, type, route, ref, network, operator, direction, tags, geometry, start_decdate, - end_decdate + end_decdate, + me_highway AS highway FROM osm_route_multilines WHERE geometry IS NOT NULL @@ -131,7 +132,8 @@ WITH union_sources AS ( osm_id::bigint AS way_id, osm_id, name, type, route, ref, network, operator, direction, tags, geometry, start_decdate, - end_decdate + end_decdate, + highway FROM osm_route_lines WHERE geometry IS NOT NULL ), @@ -156,16 +158,17 @@ data_for_null_dates AS ( jsonb_build_object( 'osm_id', u.osm_id, 'ref', u.ref, - 'route', u.route, + 'route', u.route, 'network', u.network, - 'name', u.name, - 'type', u.type, - 'operator', u.operator, - 'direction', u.direction, + 'name', u.name, + 'type', u.type, + 'operator', u.operator, + 'direction', u.direction, 'tags', u.tags ) ORDER BY u.ref - ) AS routes -- position 9 + ) AS routes, -- position 9 + MAX(u.highway) AS highway -- all rows share the same way_id, so highway is identical; MAX is just to satisfy GROUP BY FROM union_sources u WHERE u.way_id NOT IN (SELECT way_id FROM ways_with_dates) GROUP BY u.way_id @@ -197,7 +200,7 @@ data_for_dated_ways AS ( -- Relate active routes to each time segment SELECT s.way_id, s.seg_start, s.seg_end, - u.osm_id, u.ref, u.route, u.network, u.name, u.type, u.operator, u.direction, u.tags, u.geometry + u.osm_id, u.ref, u.route, u.network, u.name, u.type, u.operator, u.direction, u.tags, u.geometry, u.highway FROM segments s JOIN union_sources u ON u.way_id = s.way_id @@ -225,18 +228,19 @@ data_for_dated_ways AS ( COUNT(DISTINCT osm_id) AS num_routes, jsonb_agg( jsonb_build_object( - 'osm_id', osm_id, - 'ref', ref, - 'route', route, - 'network', network, + 'osm_id', osm_id, + 'ref', ref, + 'route', route, + 'network', network, 'name', name, - 'type', type, - 'operator', operator, - 'direction', direction, + 'type', type, + 'operator', operator, + 'direction', direction, 'tags', tags ) ORDER BY ref ) AS routes, + MAX(highway) AS highway, -- same value per way_id; MAX just satisfies GROUP BY md5( jsonb_agg( jsonb_build_object( @@ -261,6 +265,7 @@ data_for_dated_ways AS ( (ARRAY_AGG(geometry))[1] AS geometry, MAX(num_routes) AS num_routes, (ARRAY_AGG(routes))[1] AS routes, + MAX(highway) AS highway, -- same value per way_id; MAX just satisfies GROUP BY routeset_hash FROM ( SELECT @@ -288,15 +293,16 @@ data_for_dated_ways AS ( ) g GROUP BY way_id, grp, routeset_hash ) - SELECT - way_id, - min_start_decdate, - max_end_decdate, - min_start_date_iso, - max_end_date_iso, - geometry, - num_routes, - routes + SELECT + way_id, + min_start_decdate, + max_end_decdate, + min_start_date_iso, + max_end_date_iso, + geometry, + num_routes, + routes, + highway FROM merged ) -- Combine the two result sets diff --git a/images/tiler-imposm/queries/ohm_mviews/routes_02_indexed.sql b/images/tiler-imposm/queries/ohm_mviews/routes_02_indexed.sql index 6f299d7d..e05e0395 100644 --- a/images/tiler-imposm/queries/ohm_mviews/routes_02_indexed.sql +++ b/images/tiler-imposm/queries/ohm_mviews/routes_02_indexed.sql @@ -34,6 +34,7 @@ WITH exploded AS ( n.max_end_date_iso, n.geometry, n.num_routes, + n.highway, r.value ->> 'ref' AS ref, r.value ->> 'network' AS network, r.value ->> 'network:wikidata' AS network_wikidata, @@ -65,6 +66,7 @@ ranked AS ( max_end_date_iso, geometry, num_routes, + highway, routes, ref, network, @@ -89,7 +91,7 @@ SELECT max_end_date_iso, geometry, num_routes, - -- direction, + highway, -- ========================================================================= -- ROAD -- For each slot we store: ref, network, network_wikidata, operator, name. @@ -418,7 +420,7 @@ WHERE type IN ('road', 'train', 'subway', 'light_rail', 'tram', 'trolleybus', 'b GROUP BY way_id, min_start_decdate, max_end_decdate, min_start_date_iso, max_end_date_iso, - geometry, num_routes, routes + geometry, num_routes, highway, routes WITH DATA; -- ============================================================================ diff --git a/images/tiler-imposm/queries/ohm_mviews/routes_03_mv.sql b/images/tiler-imposm/queries/ohm_mviews/routes_03_mv.sql index eae44b8c..655e47e8 100644 --- a/images/tiler-imposm/queries/ohm_mviews/routes_03_mv.sql +++ b/images/tiler-imposm/queries/ohm_mviews/routes_03_mv.sql @@ -51,6 +51,7 @@ BEGIN WHEN %s > 0 THEN ST_Simplify(geometry, %s) ELSE geometry END AS geometry, + NULLIF(highway, '') AS highway, NULLIF(route_road_1_ref, '') AS route_road_1_ref, NULLIF(route_road_1_network, '') AS route_road_1_network, NULLIF(route_road_1_network_wikidata, '') AS route_road_1_network_wikidata, diff --git a/images/tiler-imposm/queries/ohm_mviews/transport_lines.sql b/images/tiler-imposm/queries/ohm_mviews/transport_lines.sql index 079e5b9c..d203c0bd 100644 --- a/images/tiler-imposm/queries/ohm_mviews/transport_lines.sql +++ b/images/tiler-imposm/queries/ohm_mviews/transport_lines.sql @@ -1,71 +1,213 @@ -- ============================================================================ --- Function: create_transport_lines_mview +-- Materialized view: mv_transport_lines_z16_20 -- Description: --- Creates a materialized view that merges transport lines from: --- - `osm_transport_lines` (ways: e.g. highway, railway), --- - `osm_transport_multilines` (relations: e.g. route relations). +-- Base materialized view that merges transport lines from: +-- - osm_transport_lines (ways: e.g. highway, railway), +-- - osm_transport_multilines (relations: e.g. route relations), +-- - osm_street_multilines (type=street relations, via street_multilines.json). -- --- Each row gets a concatenated `id` (id + osm_id) and is marked with a --- `source_type` ('way' or 'relation'). Multilingual name columns are added. --- Supports geometry simplification and filtering by type/class. +-- Ways that are members of type=street relations are expanded: each +-- (way, street-relation) pair produces one feature. The relation's values +-- override the way's values: +-- - name : relation's name if present, else way's name (fallback). +-- - start_date: always from the relation when one exists, else from way. +-- - end_date : always from the relation when one exists, else from way. +-- - other tags: relation's tags applied on top (way tags as base). +-- Ways with no type=street membership produce a single unchanged feature. -- --- Parameters: --- view_name TEXT - Final materialized view name. --- simplified_tolerance INTEGER - Tolerance for ST_Simplify (0 = no simplification). --- types TEXT[] - Array of types to include (use ARRAY['*'] for all). --- classes TEXT[] - Array of classes to include (use ARRAY['*'] for all). +-- Each row gets a concatenated id (id + osm_id) and is marked with a +-- source_type ('way' or 'relation'). Multilingual name columns are added. -- --- Notes: --- - Filtering uses OR logic: (type IN types) OR (class IN classes). --- - Only valid geometries (LineString) are included from relation sources. --- - View uses GiST index on geometry and unique index on `id`. +-- All derived zoom-level views (z13_15, z10_12, etc.) cascade from this one. -- ============================================================================ +DROP MATERIALIZED VIEW IF EXISTS mv_transport_lines_z16_20 CASCADE; -DROP FUNCTION IF EXISTS create_transport_lines_mview; - -CREATE OR REPLACE FUNCTION create_transport_lines_mview( - view_name TEXT, - simplified_tolerance INTEGER, - types TEXT[], - classes TEXT[] -) -RETURNS void AS $$ +DO $do$ DECLARE lang_columns TEXT := get_language_columns(); - tmp_view_name TEXT := view_name || '_tmp'; - unique_columns TEXT := 'id'; - type_filter TEXT; - class_filter TEXT; sql_create TEXT; BEGIN - -- Build type filter: '*' means all types - IF types @> ARRAY['*'] THEN - type_filter := '1=1'; - ELSE - type_filter := format('type = ANY(%L)', types); - END IF; + sql_create := format($sql$ + CREATE MATERIALIZED VIEW mv_transport_lines_z16_20_tmp AS + WITH + -- ----------------------------------------------------------------------- + -- CTE: attr_diff_pairs + -- + -- Identifies (way, street-relation) pairs where the relation overrides + -- at least one attribute compared to the way. Only these pairs produce + -- separate relation-expanded features and trigger date trimming on the + -- standalone way. When all attributes match, the way keeps its original + -- date range and no expanded feature is emitted. + -- ----------------------------------------------------------------------- + attr_diff_pairs AS ( + SELECT sm.member::bigint AS way_osm_id, sm.osm_id AS rel_osm_id, sm.start_date AS rel_start_date + FROM osm_transport_lines AS tl + INNER JOIN osm_street_multilines AS sm + ON sm.member::bigint = tl.osm_id + AND ST_GeometryType(sm.geometry) = 'ST_LineString' + WHERE tl.geometry IS NOT NULL + AND ( + (NULLIF(sm.name, '') IS NOT NULL AND sm.name IS DISTINCT FROM tl.name) + OR (NULLIF(sm.highway, '') IS NOT NULL AND sm.highway IS DISTINCT FROM tl.highway) + OR (NULLIF(sm.ref, '') IS NOT NULL AND sm.ref IS DISTINCT FROM tl.ref) + OR (NULLIF(sm.access, '') IS NOT NULL AND sm.access IS DISTINCT FROM tl.access) + OR (NULLIF(sm.service, '') IS NOT NULL AND sm.service IS DISTINCT FROM tl.service) + OR (NULLIF(sm.ford, '') IS NOT NULL AND sm.ford IS DISTINCT FROM tl.ford) + OR (NULLIF(sm.electrified,'')IS NOT NULL AND sm.electrified IS DISTINCT FROM tl.electrified) + OR (NULLIF(sm.highspeed, '') IS NOT NULL AND sm.highspeed IS DISTINCT FROM tl.highspeed) + OR (NULLIF(sm.usage, '') IS NOT NULL AND sm.usage IS DISTINCT FROM tl.usage) + OR (NULLIF(sm.railway, '') IS NOT NULL AND sm.railway IS DISTINCT FROM tl.railway) + OR (NULLIF(sm.aeroway, '') IS NOT NULL AND sm.aeroway IS DISTINCT FROM tl.aeroway) + OR (NULLIF(sm.route, '') IS NOT NULL AND sm.route IS DISTINCT FROM tl.route) + OR (sm.tunnel IS NOT NULL AND sm.tunnel IS DISTINCT FROM tl.tunnel) + OR (sm.bridge IS NOT NULL AND sm.bridge IS DISTINCT FROM tl.bridge) + OR (sm.oneway IS NOT NULL AND sm.oneway IS DISTINCT FROM tl.oneway) + ) + ), + -- ----------------------------------------------------------------------- + -- CTE: street_rel_dates + -- + -- For each way with attribute-changing street relations, computes the + -- earliest relation start_date. Used to trim the standalone way's + -- end_date so it doesn't overlap with the relation's time period. + -- Relations with identical attributes are excluded (the way keeps its + -- original date range for those). + -- ----------------------------------------------------------------------- + street_rel_dates AS ( + SELECT + way_osm_id, + MIN(NULLIF(rel_start_date, '')) AS earliest_rel_start + FROM attr_diff_pairs + WHERE NULLIF(rel_start_date, '') IS NOT NULL + GROUP BY way_osm_id + ), + -- ----------------------------------------------------------------------- + -- CTE: way_street_expanded + -- + -- Produces all transport line features from ways, always including the + -- standalone way feature plus any street-relation-expanded features. + -- + -- Part 1 (standalone ways): + -- Every way from osm_transport_lines appears as-is with its own + -- properties. When the way belongs to a street relation that changes + -- attributes, the way's end_date is trimmed to the earliest such + -- relation's start_date so the time periods do not overlap. When the + -- relation has identical attributes, the way keeps its original dates + -- (no split needed). + -- + -- Part 2 (street-relation-expanded): + -- Only produced when the relation changes at least one attribute. + -- The relation's values override the way's: + -- - name : relation's name if present, else way's name. + -- - start_date: from the relation. + -- - end_date : from the relation. + -- - tags : relation tags merged on top of way tags. + -- + -- Example A (relation changes name → split): + -- Way 100 (start_date=1915, name="Old Road") belongs to street + -- relation -5000 (start_date=1984, name="Oak Street"). + -- + -- Result (no overlapping time periods): + -- ┌──────────────┬────────┬──────────────┬────────────┬──────────┬──────────────────┐ + -- │ id │ osm_id │ name │ start_date │ end_date │ street_rel_osm_id│ + -- ├──────────────┼────────┼──────────────┼────────────┼──────────┼──────────────────┤ + -- │ 1_100 │ 100 │ Old Road │ 1915 │ 1984 │ NULL │ ← way trimmed + -- │ -5000_100 │ 100 │ Oak Street │ 1984 │ │ -5000 │ ← relation overrides + -- └──────────────┴────────┴──────────────┴────────────┴──────────┴──────────────────┘ + -- + -- Example B (relation has same attributes → merged): + -- Way 100 (start_date=1915, name="Oak Street") belongs to street + -- relation -5000 (start_date=1984, name="Oak Street"). All attributes + -- are identical, so no expanded feature is produced. + -- + -- Result (single feature with full date range): + -- ┌──────────────┬────────┬──────────────┬────────────┬──────────┬──────────────────┐ + -- │ id │ osm_id │ name │ start_date │ end_date │ street_rel_osm_id│ + -- ├──────────────┼────────┼──────────────┼────────────┼──────────┼──────────────────┤ + -- │ 1_100 │ 100 │ Oak Street │ 1915 │ │ NULL │ ← way untrimmed + -- └──────────────┴────────┴──────────────┴────────────┴──────────┴──────────────────┘ + -- ----------------------------------------------------------------------- + way_street_expanded AS ( + -- Part 1: Standalone ways (always present) + SELECT + COALESCE(CAST(tl.id AS TEXT), '') || '_' || COALESCE(CAST(tl.osm_id AS TEXT), '') AS id, + tl.osm_id, + tl.geometry, + tl.highway, + tl.type, + tl.class, + tl.name, + tl.tunnel, + tl.bridge, + tl.oneway, + tl.ref, + tl.z_order, + tl.access, + tl.service, + tl.ford, + tl.electrified, + tl.highspeed, + tl.usage, + tl.railway, + tl.aeroway, + tl.route, + tl.tags, + tl.start_date, + LEAST(NULLIF(tl.end_date, ''), srd.earliest_rel_start) AS end_date, + NULL::bigint AS street_rel_osm_id + FROM osm_transport_lines AS tl + LEFT JOIN street_rel_dates AS srd ON srd.way_osm_id = tl.osm_id + WHERE tl.geometry IS NOT NULL - -- Build class filter: '*' means all classes - IF classes @> ARRAY['*'] THEN - class_filter := '1=1'; - ELSE - class_filter := format('class = ANY(%L)', classes); - END IF; + UNION ALL - sql_create := format($sql$ - CREATE MATERIALIZED VIEW %I AS - WITH combined AS ( + -- Part 2: Street-relation-expanded features SELECT - (COALESCE(CAST(id AS TEXT), '') || '_' || COALESCE(CAST(osm_id AS TEXT), '')) AS id, + COALESCE(CAST(sm.osm_id AS TEXT), '') || '_' || COALESCE(CAST(tl.osm_id AS TEXT), '') AS id, + tl.osm_id, + tl.geometry, + COALESCE(NULLIF(sm.highway, ''), tl.highway) AS highway, + tl.type, + tl.class, + COALESCE(NULLIF(sm.name, ''), NULLIF(tl.name, '')) AS name, + COALESCE(sm.tunnel, tl.tunnel) AS tunnel, + COALESCE(sm.bridge, tl.bridge) AS bridge, + COALESCE(sm.oneway, tl.oneway) AS oneway, + COALESCE(NULLIF(sm.ref, ''), tl.ref) AS ref, + COALESCE(sm.z_order, tl.z_order) AS z_order, + COALESCE(NULLIF(sm.access, ''), tl.access) AS access, + COALESCE(NULLIF(sm.service, ''), tl.service) AS service, + COALESCE(NULLIF(sm.ford, ''), tl.ford) AS ford, + COALESCE(NULLIF(sm.electrified,''),tl.electrified) AS electrified, + COALESCE(NULLIF(sm.highspeed,''), tl.highspeed) AS highspeed, + COALESCE(NULLIF(sm.usage, ''), tl.usage) AS usage, + COALESCE(NULLIF(sm.railway, ''), tl.railway) AS railway, + COALESCE(NULLIF(sm.aeroway, ''), tl.aeroway) AS aeroway, + COALESCE(NULLIF(sm.route, ''), tl.route) AS route, + sm.tags || tl.tags AS tags, + sm.start_date, + sm.end_date, + sm.osm_id AS street_rel_osm_id + FROM osm_transport_lines AS tl + INNER JOIN osm_street_multilines AS sm + ON sm.member::bigint = tl.osm_id + AND ST_GeometryType(sm.geometry) = 'ST_LineString' + WHERE tl.geometry IS NOT NULL + AND EXISTS ( + SELECT 1 FROM attr_diff_pairs AS adp + WHERE adp.way_osm_id = tl.osm_id AND adp.rel_osm_id = sm.osm_id + ) + ), + combined AS ( + -- ------------------------------------------------------------------- + -- Ways (possibly expanded by street relations) + -- ------------------------------------------------------------------- + SELECT + id, ABS(osm_id) AS osm_id, - CASE - WHEN %s > 0 THEN ST_Simplify(geometry, %s) - ELSE geometry - END AS geometry, - -- Detect highways in construcion https://github.com/OpenHistoricalMap/issues/issues/1151 + geometry, CASE WHEN highway = 'construction' THEN - -- If the 'construction' tag has a value, append '_construction'. Otherwise, use 'road_construction'. COALESCE(NULLIF(tags->'construction', '') || '_construction', 'road_construction') ELSE type END AS type, @@ -92,26 +234,26 @@ BEGIN isodatetodecimaldate(pad_date(start_date, 'start'), FALSE) AS start_decdate, isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate, tags, - NULL AS member, + ABS(street_rel_osm_id) AS relation, 'way' AS source_type, %s - FROM osm_transport_lines - WHERE geometry IS NOT NULL - AND ( %s - OR %s) + FROM way_street_expanded + WHERE NOT EXISTS ( + SELECT 1 FROM osm_transport_multilines AS tm + WHERE tm.member::bigint = way_street_expanded.osm_id + ) UNION ALL + -- ------------------------------------------------------------------- + -- Transport relation members (route relations, etc.) + -- ------------------------------------------------------------------- SELECT (COALESCE(CAST(id AS TEXT), '') || '_' || COALESCE(CAST(osm_id AS TEXT), '')) AS id, - ABS(osm_id) AS osm_id, - CASE - WHEN %s > 0 THEN ST_Simplify(geometry, %s) - ELSE geometry - END AS geometry, + ABS(member::bigint) AS osm_id, + geometry, CASE WHEN highway = 'construction' THEN - -- If the 'construction' tag has a value, append '_construction'. Otherwise, use 'road_construction'. COALESCE(NULLIF(tags->'construction', '') || '_construction', 'road_construction') ELSE type END AS type, @@ -138,34 +280,26 @@ BEGIN isodatetodecimaldate(pad_date(start_date, 'start'), FALSE) AS start_decdate, isodatetodecimaldate(pad_date(end_date, 'end'), FALSE) AS end_decdate, tags, - member, + ABS(osm_id) AS relation, 'relation' AS source_type, %s FROM osm_transport_multilines WHERE ST_GeometryType(geometry) = 'ST_LineString' AND geometry IS NOT NULL - AND (%s - OR %s) ) SELECT DISTINCT ON (id) * FROM combined; - $sql$, tmp_view_name, - simplified_tolerance, simplified_tolerance, lang_columns, type_filter, class_filter, - simplified_tolerance, simplified_tolerance, lang_columns, type_filter, class_filter); + $sql$, lang_columns, lang_columns); PERFORM finalize_materialized_view( - tmp_view_name, - view_name, - unique_columns, + 'mv_transport_lines_z16_20_tmp', + 'mv_transport_lines_z16_20', + 'id', sql_create ); END; -$$ LANGUAGE plpgsql; +$do$; + --- ============================================================================ --- Create materialized views for transport lines --- ============================================================================ -DROP MATERIALIZED VIEW IF EXISTS mv_transport_lines_z16_20 CASCADE; -SELECT create_transport_lines_mview('mv_transport_lines_z16_20', 0, ARRAY['*'], ARRAY['railway','route']); SELECT create_mview_line_from_mview('mv_transport_lines_z16_20', 'mv_transport_lines_z13_15', 5, 'type IN (''motorway'', ''motorway_link'', ''trunk'', ''trunk_link'', ''construction'', ''primary'', ''primary_link'', ''rail'', ''secondary'', ''secondary_link'', ''tertiary'', ''tertiary_link'', ''miniature'', ''narrow_gauge'', ''dismantled'', ''abandoned'', ''disused'', ''razed'', ''light_rail'', ''preserved'', ''proposed'', ''tram'', ''funicular'', ''monorail'', ''taxiway'', ''runway'', ''raceway'', ''residential'', ''service'', ''unclassified'') OR class IN (''railway'')'); SELECT create_mview_line_from_mview('mv_transport_lines_z13_15', 'mv_transport_lines_z10_12', 20, 'type IN (''motorway'', ''motorway_link'', ''trunk'', ''trunk_link'', ''construction'', ''primary'', ''primary_link'', ''rail'', ''secondary'', ''secondary_link'', ''tertiary'', ''tertiary_link'', ''miniature'', ''narrow_gauge'', ''dismantled'', ''abandoned'', ''disused'', ''razed'', ''light_rail'', ''preserved'', ''proposed'', ''tram'', ''funicular'', ''monorail'', ''taxiway'', ''runway'') OR class IN (''railway'')'); SELECT create_mview_line_from_mview('mv_transport_lines_z10_12', 'mv_transport_lines_z8_9', 100, NULL); diff --git a/images/tiler-imposm/scripts/create_mviews.sh b/images/tiler-imposm/scripts/create_mviews.sh index e3b3c0da..aa3708a2 100755 --- a/images/tiler-imposm/scripts/create_mviews.sh +++ b/images/tiler-imposm/scripts/create_mviews.sh @@ -72,7 +72,8 @@ execute_sql_file queries/ohm_mviews/admin_boundaries_maritime.sql execute_sql_file queries/ohm_mviews/amenity.sql & execute_sql_file queries/ohm_mviews/buildings.sql & -execute_sql_file queries/ohm_mviews/others.sql +execute_sql_file queries/ohm_mviews/others.sql +execute_sql_file queries/ohm_mviews/communication.sql & execute_sql_file queries/ohm_mviews/places.sql & execute_sql_file queries/ohm_mviews/transport_areas.sql & diff --git a/images/tiler-imposm/scripts/refresh_mviews.sh b/images/tiler-imposm/scripts/refresh_mviews.sh index 48e54d6e..5da88124 100755 --- a/images/tiler-imposm/scripts/refresh_mviews.sh +++ b/images/tiler-imposm/scripts/refresh_mviews.sh @@ -139,6 +139,12 @@ others_views=( mv_other_lines_z14_15 ) +communication_views=( + # lines + mv_communication_z16_20 + mv_communication_z14_15 +) + places_views=( mv_place_points_centroids_z0_2 mv_place_points_centroids_z3_5 @@ -242,6 +248,7 @@ refresh_mviews_group "TRANSPORTS" 180 "${transport_views[@]}" & refresh_mviews_group "AMENITY" 180 "${amenity_views[@]}" & refresh_mviews_group "LANDUSE" 180 "${landuse_views[@]}" & refresh_mviews_group "OTHERS" 180 "${others_views[@]}" & +refresh_mviews_group "COMMUNICATION" 180 "${communication_views[@]}" & refresh_mviews_group "PLACES" 180 "${places_views[@]}" & refresh_mviews_group "WATER" 180 "${water_views[@]}" & refresh_mviews_group "BUILDINGS" 180 "${buildings_views[@]}" & diff --git a/images/tiler-imposm/scripts/reimport_layer.sh b/images/tiler-imposm/scripts/reimport_layer.sh new file mode 100755 index 00000000..ffc75288 --- /dev/null +++ b/images/tiler-imposm/scripts/reimport_layer.sh @@ -0,0 +1,62 @@ +#!/bin/bash +set -e +source ./scripts/utils.sh + +# Usage: ./scripts/reimport_layer.sh [layer2] ... +# Example: ./scripts/reimport_layer.sh communication_lines communication_multilines + +WORKDIR=/mnt/data +PBFFILE="${WORKDIR}/osm.pbf" +LAYERS_DIR="./config/layers" +TMP_MAPPING="./config/imposm3_reimport.json" +TMP_CONFIG="./config/config_reimport.json" +TMP_CACHE="./cachedir_reimport" + +# Validate arguments +if [ $# -eq 0 ]; then + echo "Usage: $0 [layer2] ..." + echo "Available layers:" + ls "$LAYERS_DIR"/*.json | xargs -I{} basename {} .json | sort | sed 's/^/ - /' + exit 1 +fi + +# Validate layers exist +for layer in "$@"; do + [ -f "$LAYERS_DIR/${layer}.json" ] || { echo "Layer not found: $layer"; exit 1; } +done + +# Build mapping config with only the specified layers +python3 -c " +import json, os +t = json.load(open('./config/imposm3.template.json')) +for l in '$*'.split(): + c = json.load(open(f'$LAYERS_DIR/{l}.json')) + t.get('generalized_tables',{}).update(c.get('generalized_tables',{})) + t.get('tables',{}).update(c.get('tables',{})) +json.dump(t, open('$TMP_MAPPING','w'), indent=2) +print('Tables:', list(t['tables'].keys())) +" + +# Create imposm config +cat <"$TMP_CONFIG" +{ + "cachedir": "$TMP_CACHE", + "diffdir": "$WORKDIR/diff", + "connection": "postgis://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB", + "mapping": "/osm/$TMP_MAPPING", + "replication_url": "$REPLICATION_URL" +} +EOF + +mkdir -p "$TMP_CACHE" + +# Import and deploy +log_message "Reimporting layers: $*" +imposm import -config "$TMP_CONFIG" -read "$PBFFILE" -write -cachedir "$TMP_CACHE" -overwritecache -optimize +imposm import -config "$TMP_CONFIG" -deployproduction + +# Cleanup +rm -f "$TMP_MAPPING" "$TMP_CONFIG" +rm -rf "$TMP_CACHE" + +log_message "$Done: $*" diff --git a/images/tiler-server/config/providers/communication_lines.toml b/images/tiler-server/config/providers/communication_lines.toml new file mode 100644 index 00000000..e6278e0f --- /dev/null +++ b/images/tiler-server/config/providers/communication_lines.toml @@ -0,0 +1,134 @@ +[[providers.layers]] +name = "communication_z10_12" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + start_date, + end_date, + start_decdate, + end_decdate, + communication_telephone, + communication_telegraph, + communication_internet, + communication_cable_television, + communication_television, + communication_radio, + communication_microwave, + communication_bos, + communication_mobile_phone, + communication_satellite, + communication_amateur_radio, + communication_optical, + communication_space, + communication_gsm_r, + telecom, + operator, + location, + layer +FROM + mv_communication_z10_12 +WHERE + geometry && !BBOX! +""" + +[[providers.layers]] +name = "communication_z13_15" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + start_date, + end_date, + start_decdate, + end_decdate, + communication_telephone, + communication_telegraph, + communication_internet, + communication_cable_television, + communication_television, + communication_radio, + communication_microwave, + communication_bos, + communication_mobile_phone, + communication_satellite, + communication_amateur_radio, + communication_optical, + communication_space, + communication_gsm_r, + telecom, + operator, + location, + layer +FROM + mv_communication_z13_15 +WHERE + geometry && !BBOX! +""" + +[[providers.layers]] +name = "communication_z16_20" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + start_date, + end_date, + start_decdate, + end_decdate, + communication_telephone, + communication_telegraph, + communication_internet, + communication_cable_television, + communication_television, + communication_radio, + communication_microwave, + communication_bos, + communication_mobile_phone, + communication_satellite, + communication_amateur_radio, + communication_optical, + communication_space, + communication_gsm_r, + telecom, + operator, + location, + layer +FROM + mv_communication_z16_20 +WHERE + geometry && !BBOX! +""" +#######Maps +[[maps.layers]] +name = "communication" +provider_layer = "ohm.communication_z10_12" +min_zoom = 10 +max_zoom = 12 + +[[maps.layers]] +name = "communication" +provider_layer = "ohm.communication_z13_15" +min_zoom = 13 +max_zoom = 15 + +[[maps.layers]] +name = "communication" +provider_layer = "ohm.communication_z16_20" +min_zoom = 16 +max_zoom = 20 diff --git a/images/tiler-server/config/providers/route_lines.toml b/images/tiler-server/config/providers/route_lines.toml index a7afdb09..e3914680 100644 --- a/images/tiler-server/config/providers/route_lines.toml +++ b/images/tiler-server/config/providers/route_lines.toml @@ -11,6 +11,7 @@ SELECT end_decdate, start_date, end_date, + highway, -- ROAD route_road_1_ref,route_road_1_network,route_road_1_network_wikidata,route_road_1_operator,route_road_1_name,route_road_1_direction, route_road_2_ref,route_road_2_network,route_road_2_network_wikidata,route_road_2_operator,route_road_2_name,route_road_2_direction, @@ -84,6 +85,7 @@ SELECT end_decdate, start_date, end_date, + highway, -- ROAD route_road_1_ref,route_road_1_network,route_road_1_network_wikidata,route_road_1_operator,route_road_1_name,route_road_1_direction, route_road_2_ref,route_road_2_network,route_road_2_network_wikidata,route_road_2_operator,route_road_2_name,route_road_2_direction, @@ -158,6 +160,7 @@ SELECT end_decdate, start_date, end_date, + highway, -- ROAD route_road_1_ref,route_road_1_network,route_road_1_network_wikidata,route_road_1_operator,route_road_1_name,route_road_1_direction, route_road_2_ref,route_road_2_network,route_road_2_network_wikidata,route_road_2_operator,route_road_2_name,route_road_2_direction, @@ -231,6 +234,7 @@ SELECT end_decdate, start_date, end_date, + highway, -- ROAD route_road_1_ref,route_road_1_network,route_road_1_network_wikidata,route_road_1_operator,route_road_1_name,route_road_1_direction, route_road_2_ref,route_road_2_network,route_road_2_network_wikidata,route_road_2_operator,route_road_2_name,route_road_2_direction, @@ -304,6 +308,7 @@ SELECT end_decdate, start_date, end_date, + highway, -- ROAD route_road_1_ref,route_road_1_network,route_road_1_network_wikidata,route_road_1_operator,route_road_1_name,route_road_1_direction, route_road_2_ref,route_road_2_network,route_road_2_network_wikidata,route_road_2_operator,route_road_2_name,route_road_2_direction, @@ -377,6 +382,7 @@ SELECT end_decdate, start_date, end_date, + highway, -- ROAD route_road_1_ref,route_road_1_network,route_road_1_network_wikidata,route_road_1_operator,route_road_1_name,route_road_1_direction, route_road_2_ref,route_road_2_network,route_road_2_network_wikidata,route_road_2_operator,route_road_2_name,route_road_2_direction, diff --git a/images/tiler-server/config/providers/transport_lines.toml b/images/tiler-server/config/providers/transport_lines.toml index f1cea34e..a952ad57 100644 --- a/images/tiler-server/config/providers/transport_lines.toml +++ b/images/tiler-server/config/providers/transport_lines.toml @@ -8,7 +8,7 @@ SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, - member, + relation, type, ref, service, @@ -41,7 +41,7 @@ SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, - member, + relation, type, ref, service, @@ -74,7 +74,7 @@ SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, - member, + relation, type, tunnel, bridge, @@ -109,7 +109,7 @@ SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, - member, + relation, type, tunnel, bridge, @@ -144,7 +144,7 @@ SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, - member, + relation, type, tunnel, bridge, @@ -179,7 +179,7 @@ SELECT ST_AsMVTGeom(geometry, !BBOX!) AS geometry, osm_id, class, - member, + relation, type, tunnel, bridge, diff --git a/images/tiler-server/scripts/build_config.py b/images/tiler-server/scripts/build_config.py index f10467f8..6278be71 100644 --- a/images/tiler-server/scripts/build_config.py +++ b/images/tiler-server/scripts/build_config.py @@ -111,7 +111,8 @@ def process_layer_blocks(raw_content: str, lang_map: dict) -> str: "landuse_lines", "other_areas", "other_points_centroids", - "other_lines" + "other_lines", + "communication_lines" ] } From d7c6ade79b5ce466bad32ce948574c8414fdde53 Mon Sep 17 00:00:00 2001 From: "Ruben L. Mendoza" Date: Thu, 26 Feb 2026 08:53:40 -0500 Subject: [PATCH 8/8] Change yarn -> pnpm overpass-turbo and Docker images for Tiler (#705) * Fixed pnpm * Fixed communication - layer name * Update docker images and volume for prod deployment --- .github/workflows/chartpress.yaml | 16 +++++++------- .github/workflows/frontend-overpass.yaml | 7 +++--- hetzner/tiler/tiler.base.yml | 10 +-------- hetzner/tiler/tiler.production.yml | 12 +++++----- hetzner/tiler/tiler.staging.yml | 22 ++++++------------- .../config/providers/communication_lines.toml | 6 ++--- 6 files changed, 29 insertions(+), 44 deletions(-) diff --git a/.github/workflows/chartpress.yaml b/.github/workflows/chartpress.yaml index 268ee223..5751f560 100644 --- a/.github/workflows/chartpress.yaml +++ b/.github/workflows/chartpress.yaml @@ -4,7 +4,7 @@ on: branches: - 'main' - 'staging' - - 'communication_and_street' + - 'fixed_pnpm' jobs: build: runs-on: ubuntu-22.04 @@ -71,7 +71,7 @@ jobs: OHM_SLACK_WEBHOOK_URL: ${{ secrets.OHM_SLACK_WEBHOOK_URL }} ################ Staging secrets ################ - name: Staging - substitute secrets - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/communication_and_street' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/fixed_pnpm' uses: bluwy/substitute-string-action@v1 with: _input-file: 'values.staging.template.yaml' @@ -189,14 +189,14 @@ jobs: PRODUCTION_OPENSTREETMAP_AUTH_SECRET: ${{ secrets.PRODUCTION_OPENSTREETMAP_AUTH_SECRET }} - name: AWS Credentials - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/communication_and_street' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/fixed_pnpm' uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Setup Kubectl and Helm Dependencies - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/communication_and_street' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/fixed_pnpm' run: | sudo pip install awscli --ignore-installed six sudo curl -L -o /usr/bin/kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.17.7/2020-07-08/bin/linux/amd64/kubectl @@ -210,22 +210,22 @@ jobs: helm version - name: Update kube-config staging - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/communication_and_street' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/fixed_pnpm' run: aws eks --region us-east-1 update-kubeconfig --name osmseed-staging - name: Update kube-config prod if: github.ref == 'refs/heads/main' run: aws eks --region us-east-1 update-kubeconfig --name osmseed-production-v2 - name: Add Helm repository - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/communication_and_street' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/fixed_pnpm' run: | helm repo add osm-seed https://osm-seed.github.io/osm-seed-chart/ helm repo update - name: Install helm dependencies for - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/communication_and_street' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/fixed_pnpm' run: cd ohm && helm dep up # Staging - name: Staging - helm deploy - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/communication_and_street' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/fixed_pnpm' run: helm upgrade --install staging --wait ohm/ -f values.staging.yaml -f ohm/values.yaml # Production - name: Production - helm deploy diff --git a/.github/workflows/frontend-overpass.yaml b/.github/workflows/frontend-overpass.yaml index de80317c..3d07eea0 100644 --- a/.github/workflows/frontend-overpass.yaml +++ b/.github/workflows/frontend-overpass.yaml @@ -5,6 +5,7 @@ on: branches: - "main" - "staging" + - "fixed_pnpm" jobs: build: @@ -20,7 +21,7 @@ jobs: access_token: ${{ github.token }} - name: Set environment variables - Staging - if: github.ref == 'refs/heads/staging' + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/fixed_pnpm' uses: allenevans/set-env@v4.0.0 with: OVERPASS_API: overpass-api.openhistoricalmap.org @@ -55,11 +56,11 @@ jobs: working-directory: overpass-turbo - name: Install dependencies - run: yarn install + run: pnpm install working-directory: overpass-turbo - name: Build project - run: yarn build + run: pnpm build working-directory: overpass-turbo - name: Setup Python diff --git a/hetzner/tiler/tiler.base.yml b/hetzner/tiler/tiler.base.yml index 6e79d492..24404513 100644 --- a/hetzner/tiler/tiler.base.yml +++ b/hetzner/tiler/tiler.base.yml @@ -1,7 +1,7 @@ services: tiler_server: container_name: tiler_server - image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3225.h2122f3e + image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3296.h0e45d176 # image: tiler-server:staging # build: # context: ../../images/tiler-server @@ -15,14 +15,6 @@ services: # - ../../images/tiler-server/start.sh:/app/start.sh:ro networks: - ohm_network - -volumes: - tiler_pgdata: - driver: local - name: tiler_db_11_02 - tiler_imposm_data: - driver: local - name: tiler_imposm_11_02 networks: ohm_network: diff --git a/hetzner/tiler/tiler.production.yml b/hetzner/tiler/tiler.production.yml index f4d6010e..89f2daec 100644 --- a/hetzner/tiler/tiler.production.yml +++ b/hetzner/tiler/tiler.production.yml @@ -16,7 +16,7 @@ services: tiler_imposm: container_name: tiler_imposm - image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3208.h6ef73bb + image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3294.h12c71f95 volumes: - tiler_imposm_data:/mnt/data env_file: @@ -38,7 +38,7 @@ services: # Tiler server tiler_server: container_name: tiler_server - image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3225.h2122f3e + image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3296.h0e45d176 # ports: # - "9090:9090" restart: always @@ -81,7 +81,7 @@ services: tile_global_seeding: container_name: tiler_global_seeding - image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3225.h2122f3e + image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3296.h0e45d176 env_file: - .env.tiler volumes: @@ -96,7 +96,7 @@ services: tile_coverage_seeding: container_name: tiler_coverage_seeding - image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3225.h2122f3e + image: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.3296.h0e45d176 volumes: - ./seed.sh:/opt/seed.sh entrypoint: @@ -128,10 +128,10 @@ services: volumes: tiler_pgdata: driver: local - name: tiler_db_11_02 + name: tiler_db_25_02 tiler_imposm_data: driver: local - name: tiler_imposm_11_02 + name: tiler_imposm_25_02 networks: ohm_network: diff --git a/hetzner/tiler/tiler.staging.yml b/hetzner/tiler/tiler.staging.yml index e8f91d5e..78ffd6c9 100644 --- a/hetzner/tiler/tiler.staging.yml +++ b/hetzner/tiler/tiler.staging.yml @@ -12,19 +12,19 @@ services: - postgres - "-c" - "config_file=/etc/postgresql/postgresql.conf" - # ports: - # - "54321:5432" + ports: + - "5432:5432" env_file: - .env.tiler networks: - ohm_network tiler_imposm: container_name: tiler_imposm - image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3208.h6ef73bb - # image: tiler-imposm:staging - # build: - # context: ../../images/tiler-imposm - # dockerfile: Dockerfile + # image: ghcr.io/openhistoricalmap/tiler-imposm:0.0.1-0.dev.git.3208.h6ef73bb + image: tiler-imposm:staging + build: + context: ../../images/tiler-imposm + dockerfile: Dockerfile volumes: - tiler_imposm_data:/mnt/data command: @@ -41,15 +41,7 @@ volumes: tiler_pgdata: driver: local name: tiler_db_11_02 - driver_opts: - type: none - o: bind - device: /mnt/HC_Volume_104590709/staging/tiler/pgdata tiler_imposm_data: driver: local name: tiler_imposm_11_02 - driver_opts: - type: none - o: bind - device: /mnt/HC_Volume_104590709/staging/tiler/imposmdata diff --git a/images/tiler-server/config/providers/communication_lines.toml b/images/tiler-server/config/providers/communication_lines.toml index e6278e0f..163cdad0 100644 --- a/images/tiler-server/config/providers/communication_lines.toml +++ b/images/tiler-server/config/providers/communication_lines.toml @@ -116,19 +116,19 @@ WHERE """ #######Maps [[maps.layers]] -name = "communication" +name = "communication_lines" provider_layer = "ohm.communication_z10_12" min_zoom = 10 max_zoom = 12 [[maps.layers]] -name = "communication" +name = "communication_lines" provider_layer = "ohm.communication_z13_15" min_zoom = 13 max_zoom = 15 [[maps.layers]] -name = "communication" +name = "communication_lines" provider_layer = "ohm.communication_z16_20" min_zoom = 16 max_zoom = 20