diff --git a/.gitignore b/.gitignore index 4c32d0b3..950167dc 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,5 @@ overpass-api-db/ data/*/ !data/README.md images/changeset-replication-job/config.yaml -values_copy.yaml \ No newline at end of file +values_copy.yaml +images/tiler-server/tegola-cache/ \ No newline at end of file diff --git a/compose/tiler.yml b/compose/tiler.yml index 11d15502..b3124f50 100644 --- a/compose/tiler.yml +++ b/compose/tiler.yml @@ -1,4 +1,4 @@ -version: '3.8' +# version: '3.8' services: # ###################################################### # ### Tiler DB @@ -8,61 +8,53 @@ services: build: context: ../images/tiler-db dockerfile: Dockerfile - # ports: - # - "5433:5432" + ports: + - "5432:5432" volumes: - ../data/tiler-db-data:/var/lib/postgresql/data env_file: - ../envs/.env.tiler-db restart: always - # ###################################################### - # ### Tiler imposm for importing data - # ###################################################### - tiler-imposm: - image: osmseed-tiler-imposm:v1 - build: - context: ../images/tiler-imposm - dockerfile: Dockerfile - volumes: - - ../data/tiler-imposm-data:/mnt/data - # - ../images/tiler-imposm:/osm - depends_on: - - tiler-db - command: - - sh - - -c - - "sleep 60 && ./start.sh" - env_file: - - ../envs/.env.tiler-db - - ../envs/.env.tiler-imposm - healthcheck: - test: ["CMD", "./liveness.sh"] - interval: 30s - timeout: 10s - retries: 3 - restart: always - # ###################################################### - # ### Tiler server - # ###################################################### + # # ###################################################### + # # ### Tiler imposm for importing data + # # ###################################################### + # tiler-imposm: + # image: osmseed-tiler-imposm:v1 + # build: + # context: ../images/tiler-imposm + # dockerfile: Dockerfile + # volumes: + # - ../data/tiler-imposm-data:/mnt/data + # # - ../images/tiler-imposm:/osm + # command: + # - sh + # - -c + # - "./start.sh" + # env_file: + # - ../envs/.env.tiler-db + # - ../envs/.env.tiler-imposm + # healthcheck: + # test: ["CMD", "./liveness.sh"] + # interval: 30s + # timeout: 10s + # retries: 3 + # restart: always + # # ###################################################### + # # ### Tiler server + # # ###################################################### tiler-server: image: osmseed-tiler-server:v1 + # platform: linux/amd64 build: context: ../images/tiler-server dockerfile: Dockerfile volumes: - - ../data/tiler-server-data:/mnt/data - - ../data/tiler-imposm-data:/mnt/data/imposm - depends_on: - - tiler-db - - tiler-imposm + - ../images/tiler-server:/app + - ../data/tiler-imposm-data:/mnt/data/imposm ports: - - "9090:9090" - command: - - sh - - -c - - "./start.sh & ./expire-watcher.sh" + - "9090:9090" + command: "./start.sh" env_file: - - ../envs/.env.tiler-db - - ../envs/.env.tiler-server - restart: always - \ No newline at end of file + - ../envs/.env.tiler-db + - ../envs/.env.tiler-server + restart: always \ No newline at end of file diff --git a/envs/.env.tiler-imposm.example b/envs/.env.tiler-imposm.example index f92de1b4..707ed23d 100644 --- a/envs/.env.tiler-imposm.example +++ b/envs/.env.tiler-imposm.example @@ -7,4 +7,6 @@ TILER_IMPORT_FROM=osm TILER_IMPORT_PBF_URL=https://download.geofabrik.de/europe/monaco-latest.osm.pbf SEQUENCE_NUMBER=4768 REPLICATION_URL=https://download.openstreetmap.fr/replication/europe/monaco/minute/ -OVERWRITE_STATE=false \ No newline at end of file +OVERWRITE_STATE=false +IMPORT_NATURAL_EARTH=true +IMPORT_OSM_LAND=true diff --git a/images/tiler-db/Dockerfile b/images/tiler-db/Dockerfile index fb664dd3..a1fccb72 100644 --- a/images/tiler-db/Dockerfile +++ b/images/tiler-db/Dockerfile @@ -1,11 +1,7 @@ -FROM mdillon/postgis:9.5 -RUN rm /etc/apt/sources.list.d/pgdg.list -RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list -RUN sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list -RUN sed -i '/stretch-updates/d' /etc/apt/sources.list -RUN apt-get update && apt-get -y install apt-transport-https -RUN echo "deb https://apt-archive.postgresql.org/pub/repos/apt/ stretch-pgdg main 9.5" /etc/apt/sources.list.d/pgdg.list -RUN apt-get update && apt-get install -y git ca-certificates +FROM postgis/postgis:14-3.4 +RUN apt-get update +RUN apt-get install -y git ca-certificates + COPY ./config/docker-entrypoint.sh /usr/local/bin/ RUN mkdir -p /docker-entrypoint-initdb.d COPY ./config/initdb_db.sh /docker-entrypoint-initdb.d/postgis.sh diff --git a/images/tiler-db/config/initdb_db.sh b/images/tiler-db/config/initdb_db.sh index 0f9d1ad1..0a4be078 100644 --- a/images/tiler-db/config/initdb_db.sh +++ b/images/tiler-db/config/initdb_db.sh @@ -1,20 +1,10 @@ #!/bin/sh set -e -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis; -UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis'; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; - CREATE EXTENSION IF NOT EXISTS hstore; -EOSQL -done \ No newline at end of file +# Add hstore into the DB +for DB in template_postgis "$POSTGRES_DB" "${@}"; do + echo "Updating extensions '$DB'" + psql --dbname="$DB" -c " + CREATE EXTENSION IF NOT EXISTS hstore; + " +done diff --git a/images/tiler-server/Dockerfile b/images/tiler-server/Dockerfile index 64255bff..ce77ee72 100644 --- a/images/tiler-server/Dockerfile +++ b/images/tiler-server/Dockerfile @@ -1,52 +1,35 @@ -FROM golang:1.14.1-alpine3.11 AS build -ENV VERSION="v0.8.1" -RUN apk update -RUN apk add musl-dev=1.1.24-r3 \ - gcc \ - bash \ - git \ - postgresql \ - postgresql-contrib +FROM gospatial/tegola:v0.20.0 -RUN mkdir -p /go/src/github.com/go-spatial/tegola -RUN git clone https://github.com/go-spatial/tegola.git /go/src/github.com/go-spatial/tegola -RUN cd /go/src/github.com/go-spatial/tegola && git checkout v0.13.0 -RUN cd /go/src/github.com/go-spatial/tegola/cmd/tegola \ - && go build -gcflags "-N -l" -o /opt/tegola \ - && chmod a+x /opt/tegola -RUN ln -s /opt/tegola /usr/bin/tegola - -RUN apk add --update \ - python3 \ - py-pip \ - py-cffi \ - py-cryptography \ - && pip install --upgrade pip \ - && apk add --virtual build-deps \ +RUN apk --no-cache add \ gcc \ libffi-dev \ - python3-dev \ + python3 \ + py3-pip \ + py3-cffi \ + py3-cryptography \ linux-headers \ musl-dev \ openssl-dev \ - curl + bash \ + git \ + postgresql-client \ + coreutils \ + jq -# Install aws-cli and gsutil -RUN pip3 install awscli -RUN curl -sSL https://sdk.cloud.google.com | bash -RUN ln -f -s /root/google-cloud-sdk/bin/gsutil /usr/bin/gsutil +RUN pip install --upgrade pip && pip3 install awscli mercantile -RUN pip3 install mercantile \ - && apk del build-deps \ - && rm -rf /var/cache/apk/* \ - && apk --purge -v del py-pip -RUN apk add --update coreutils jq && rm -rf /var/cache/apk/* +RUN ln -s /opt/tegola /usr/bin/tegola + +COPY ./config /opt/config/ +COPY build_config.py /opt/ +RUN mkdir /opt/tegola_config +RUN cd /opt/ && python build_config.py \ + --template config/config.template.toml \ + --providers config/providers \ + --output /opt/tegola_config/config.toml -# Volumen -VOLUME /mnt/data # Copy config and exec files -COPY ./config/config.toml /opt/tegola_config/config.toml COPY ./tile2bounds.py . COPY ./start.sh . COPY ./expire-watcher.sh . @@ -54,4 +37,5 @@ COPY ./seed-by-diffs.sh . COPY ./tile_cache_downloader.sh . COPY ./rm_tegola_ps.sh . +ENTRYPOINT ["/bin/bash", "-c"] CMD ./start.sh & ./tile_cache_downloader.sh & ./expire-watcher.sh & ./rm_tegola_ps.sh diff --git a/images/tiler-server/build_config.py b/images/tiler-server/build_config.py new file mode 100644 index 00000000..5377696a --- /dev/null +++ b/images/tiler-server/build_config.py @@ -0,0 +1,38 @@ +import os +import argparse +parser = argparse.ArgumentParser(description='Merge TOML files into a configuration file.') +parser.add_argument('--template', default='config/config.template.toml', help='Path to the configuration template file.') +parser.add_argument('--providers', default='config/providers', help='Directory containing provider TOML files.') +parser.add_argument('--output', default='config/config.toml', help='Output configuration file path.') +args = parser.parse_args() + +config_template_file = args.template +providers_dir = args.providers +output_file_path = args.output +toml_files = [file for file in os.listdir(providers_dir) if file.endswith(".toml")] + +# Read TOML files +new_configs = {} +for toml_file in toml_files: + dir_toml_file = os.path.join(providers_dir, toml_file) + with open(dir_toml_file, "r") as file: + new_configs[dir_toml_file] = file.read() + +with open(config_template_file, "r") as main_file: + content = main_file.read() + +# Replace the content of main.toml with the content read from other TOML files +for toml_file, toml_file_content in new_configs.items(): + print(f"Copy {toml_file} to config.toml") + section_header = "[['{}']]".format(toml_file.replace("config/", "")) + indentation_level = content.find(section_header) + if indentation_level != -1: + # Find the appropriate number of tabs or spaces for indentation + preceding_newline = content.rfind('\n', 0, indentation_level) + indentation = content[preceding_newline + 1:indentation_level] + toml_file_content = f"###### From {toml_file} \n" + toml_file_content + new_values=toml_file_content.replace("\n", "\n" + indentation) + content = content.replace(section_header, new_values) + +with open(output_file_path, "w") as output_file: + output_file.write(content) diff --git a/images/tiler-server/config/config.template.toml b/images/tiler-server/config/config.template.toml new file mode 100644 index 00000000..c7c6db6e --- /dev/null +++ b/images/tiler-server/config/config.template.toml @@ -0,0 +1,212 @@ +[webserver] +port = ":${TILER_SERVER_PORT}" + + [webserver.headers] + Access-Control-Allow-Origin = "*" + +# Tegola offers three tile caching strategies: "file", "redis", and "s3" +[cache] +type = "${TILER_CACHE_TYPE}" +basepath ="${TILER_CACHE_BASEPATH}" +max_zoom = "${TILER_CACHE_MAX_ZOOM}" + +bucket = "${TILER_CACHE_BUCKET}" +region = "${TILER_CACHE_REGION}" +aws_access_key_id = "${TILER_CACHE_AWS_ACCESS_KEY_ID}" +aws_secret_access_key = "${TILER_CACHE_AWS_SECRET_ACCESS_KEY}" + +# metrics +[observer] +type = "prometheus" + +# OpenStreetMap (OSM) +[[providers]] +name = "osm" +type = "mvt_postgis" +uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" +# srid = 3857 +max_connections = 200 + ###### Land providers + [['providers/land.toml']] + + ###### Water areas and lines + [['providers/water_areas.toml']] + + [['providers/water_lines.toml']] + + ###### Water areas NE + [['providers/water_areas_ne.toml']] + + ###### Admin boundaries providers + [['providers/admin_boundaries_areas.toml']] + + ###### Land use areas + [['providers/landuse_areas.toml']] + + ###### Land use lines and points + [['providers/landuse_lines.toml']] + [['providers/landuse_points.toml']] + + ###### Transport lines, points and areas from ways + [['providers/transport_points.toml']] + [['providers/transport_lines.toml']] + [['providers/transport_areas.toml']] + + ###### Amenities areas and points + [['providers/amenity_areas.toml']] + [['providers/amenity_points.toml']] + + ###### Place points and areas + [['providers/place_points.toml']] + [['providers/place_areas.toml']] + + ###### Other (Man Made, Historic, Military, Power, Barrier etc) + [['providers/other_points.toml']] + [['providers/other_lines.toml']] + [['providers/other_areas.toml']] + + ###### Buildings + [['providers/buildings.toml']] + + ###### transport_associated_streets + [['providers/transport_associated_streets.toml']] + +# Natural Earth (ne) +[[providers]] +name = "ne" +type = "mvt_postgis" +uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" + +# srid = 3857 +max_connections = 200 + ###### Admin lines ne + [['providers/admin_ne.toml']] + ###### Water lands ne + [['providers/water_areas_ne.toml']] + +[[maps]] +name = "osm" +attribution = "OpenStreetMap" +center = [-74.275329586789, -12.153492567373, 8.0] + ###### Land + [['providers/land.zoom.toml']] + + ##### Admin boundaries display zooms + [['providers/admin_boundaries_areas.zoom.toml']] + + ###### Land Use + [['providers/landuse_areas.zoom.toml']] + [['providers/landuse_lines.zoom.toml']] + [['providers/landuse_points.zoom.toml']] + + ###### Water areas/lines + [['providers/water_areas.zoom.toml']] + [['providers/water_lines.zoom.toml']] + + # Transport Lines (Roads, Rail, Aviation) + [['providers/transport_lines.zoom.toml']] + [['providers/route_lines.zoom.toml']] + + ###### admin_boundaries_maritime + [['providers/admin_boundaries_maritime.zoom.toml']] + + # Transport Areas + [[maps.layers]] + name = "transport_areas" + provider_layer = "osm.transport_areas" + min_zoom = 12 + max_zoom = 20 + + # Transport Points + [[maps.layers]] + name = "transport_points" + provider_layer = "osm.transport_points" + min_zoom = 14 + max_zoom = 20 + + # Amenity Areas + [[maps.layers]] + name = "amenity_areas" + provider_layer = "osm.amenity_areas" + min_zoom = 14 + max_zoom = 20 + + + + # Amenity Points + [[maps.layers]] + name = "amenity_points" + provider_layer = "osm.amenity_points" + min_zoom = 14 + max_zoom = 20 + + # Place Points + [[maps.layers]] + name = "place_points" + provider_layer = "osm.place_points" + min_zoom = 1 + max_zoom = 20 + + # Place areas + [[maps.layers]] + name = "place_areas" + provider_layer = "osm.place_areas" + min_zoom = 14 + max_zoom = 20 + + # Other Points + [[maps.layers]] + name = "other_points" + provider_layer = "osm.other_points" + min_zoom = 14 + max_zoom = 20 + + # Other Lines + [[maps.layers]] + name = "other_lines" + provider_layer = "osm.other_lines" + min_zoom = 14 + max_zoom = 20 + + # Other Areas + [['providers/other_areas.zoom.toml']] + + # Buildings + [[maps.layers]] + name = "buildings" + provider_layer = "osm.buildings" + min_zoom = 14 + max_zoom = 20 + + + [[maps.layers]] + name = "transport_associated_streets" + provider_layer = "osm.transport_associated_streets" + min_zoom = 7 + max_zoom = 20 + + +[[maps]] +name = "ne" +attribution = "Natural Earth" +center = [-74.275329586789, -12.153492567373, 8.0] + + [['providers/admin_ne.zoom.toml']] + # Water lakes Natural Earth + [[maps.layers]] + name = "water_areas" + provider_layer = "ne.ne_water_lakes_0-2" + min_zoom = 0 + max_zoom = 2 + + [[maps.layers]] + name = "water_areas" + provider_layer = "ne.ne_water_lakes_3-5" + min_zoom = 3 + max_zoom = 5 + + [[maps.layers]] + name = "water_areas" + provider_layer = "ne.ne_water_lakes_6-8" + min_zoom = 6 + max_zoom = 8 diff --git a/images/tiler-server/config/config.toml b/images/tiler-server/config/config.toml index 3b8faa16..fdef2dcc 100644 --- a/images/tiler-server/config/config.toml +++ b/images/tiler-server/config/config.toml @@ -1,6 +1,9 @@ [webserver] port = ":${TILER_SERVER_PORT}" + [webserver.headers] + Access-Control-Allow-Origin = "*" + # Tegola offers three tile caching strategies: "file", "redis", and "s3" [cache] type = "${TILER_CACHE_TYPE}" @@ -12,588 +15,1682 @@ region = "${TILER_CACHE_REGION}" aws_access_key_id = "${TILER_CACHE_AWS_ACCESS_KEY_ID}" aws_secret_access_key = "${TILER_CACHE_AWS_SECRET_ACCESS_KEY}" -# OpenStreetMap (OSM) +# metrics +[observer] +type = "prometheus" + +# OpenStreetMap (OSM) [[providers]] name = "osm" -type = "postgis" -host = "${POSTGRES_HOST}" -port = 5432 -database = "${POSTGRES_DB}" -user = "${POSTGRES_USER}" -password = "${POSTGRES_PASSWORD}" -srid = 3857 -max_connections = 40 - +type = "mvt_postgis" +uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" +# srid = 3857 +max_connections = 200 + ###### Land providers + ###### From config/providers/land.toml + # Simplification for geometries + # Zoom levels 0-2,Tolerance=500 => ~1000 meters + # Zoom levels 3-5,Tolerance=200=> ~500 meters + # Zoom levels 6-7,Tolerance=100=> ~200 meters + # Zoom levels 8-9,Tolerance=50=> ~100 meters + # Zoom levels 10-12,Tolerance=20=> ~50 meters + # Zoom levels 13-15,Tolerance=5=> ~20 meters + # Zoom levels 16-20,Tolerance=1=> ~5 meters + [[providers.layers]] - name = "land_8-20" + name = "land_0-2" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" - - # Water + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 500),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + [[providers.layers]] - name = "water_areas" + name = "land_3-5" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, type, area FROM osm_water_areas WHERE type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank', 'dock') AND geometry && !BBOX!" - + geometry_type = "multipolygon" + id_fieldname = "ogc_fid" + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 200),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + [[providers.layers]] - name = "water_areas_gen0" + name = "land_6-7" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, type, area FROM osm_water_areas_gen0 WHERE type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') AND area > 1000000000 AND geometry && !BBOX!" + geometry_type = "multipolygon" + id_fieldname = "ogc_fid" + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 70),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + + [[providers.layers]] + name = "land_8-9" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "ogc_fid" + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 30),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + + [[providers.layers]] + name = "land_10-12" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "ogc_fid" + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 10),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + + [[providers.layers]] + name = "land_13-15" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "ogc_fid" + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 5),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + + [[providers.layers]] + name = "land_16-20" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "ogc_fid" + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 1),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + + ###### Water areas and lines + ###### From config/providers/water_areas.toml [[providers.layers]] - name = "water_areas_gen0_6" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, type, area FROM osm_water_areas_gen0 WHERE type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') AND area > 100000000 AND geometry && !BBOX!" - + name = "water_areas_gen0_0-2" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 10000), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_water_areas_gen0 + WHERE + type IN ('water', 'riverbank') + AND area > 100000000 + AND geometry && !BBOX! + """ + [[providers.layers]] - name = "water_areas_gen1" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, type, area FROM osm_water_areas_gen1 WHERE type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') AND area > 1000 AND geometry && !BBOX!" - + name = "water_areas_gen0_3-5" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 1000), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_water_areas_gen0 + WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') + AND area > 50000000 + AND geometry && !BBOX! + """ + + # Water bodies > 1,000,000 sqm [[providers.layers]] - name = "water_lines" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, type FROM osm_water_lines WHERE type IN ('river', 'canal', 'stream', 'ditch', 'drain', 'dam') AND geometry && !BBOX!" - + name = "water_areas_gen0_6-7" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 500), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_water_areas_gen0 + WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') + AND area > 1000000 + AND geometry && !BBOX! + """ + + # Water bodies > 10,000 sqm [[providers.layers]] - name = "water_lines_gen0" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, type FROM osm_water_lines_gen0 WHERE type IN ('river', 'canal') AND geometry && !BBOX!" - + name = "water_areas_gen0_8-9" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 100), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_water_areas_gen0 + WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') + AND area > 10000 + AND geometry && !BBOX! + """ + [[providers.layers]] - name = "water_lines_gen1" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, type FROM osm_water_lines_gen1 WHERE type IN ('river', 'canal', 'stream', 'ditch', 'drain', 'dam') AND geometry && !BBOX!" - + name = "water_areas_gen1_10-12" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 50), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_water_areas_gen1 + WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') + AND geometry && !BBOX! + """ + + [[providers.layers]] + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + name = "water_areas_13-15" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 5), !BBOX!) AS geometry, + id, + osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_water_areas + WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank', 'dock') + AND geometry && !BBOX! + """ + [[providers.layers]] - name = "admin_boundaries_8-12" geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + name = "water_areas_16-20" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_water_areas + WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank', 'dock') + AND geometry && !BBOX! + """ + + + ###### From config/providers/water_lines.toml + # Simplification for geometries + + [[providers.layers]] + geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, admin_level, name, type FROM osm_admin_areas WHERE admin_level IN (1,2,3,4,5,6,7,8) AND geometry && !BBOX!" - + name = "water_lines_gen0_6-6" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 1500), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge + FROM + osm_water_lines_gen0 + WHERE + type IN ('river', 'canal') + AND geometry && !BBOX! + """ + [[providers.layers]] - name = "admin_boundaries_13-20" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, admin_level, name, type FROM osm_admin_areas WHERE admin_level IN (1,2,3,4,5,6,7,8,9,10) AND geometry && !BBOX!" - - # Land Use + name = "water_lines_gen0_7-7" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 1000), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge + FROM + osm_water_lines_gen0 + WHERE + type IN ('river', 'canal') + AND geometry && !BBOX! + """ + [[providers.layers]] - name = "landuse_areas" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type, area FROM osm_landuse_areas WHERE geometry && !BBOX!" - + name = "water_lines_gen0_8-8" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 500), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge + FROM + osm_water_lines_gen0 + WHERE + type IN ('river', 'canal') + AND geometry && !BBOX! + """ + [[providers.layers]] - name = "landuse_areas_gen0" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type, area FROM osm_landuse_areas_gen0 WHERE type IN ('forest','wood','nature reserve', 'nature_reserve', 'military') AND area > 1000000000 AND geometry && !BBOX!" - + name = "water_lines_gen0_9-9" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 100), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge + FROM + osm_water_lines_gen0 + WHERE + type IN ('river', 'canal') + AND geometry && !BBOX! + """ + + [[providers.layers]] - name = "landuse_areas_gen0_6" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type, area FROM osm_landuse_areas_gen0 WHERE type IN ('forest','wood','nature reserve', 'nature_reserve', 'military') AND area > 100000000 AND geometry && !BBOX!" + name = "water_lines_gen1_10-11" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 20), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge, + tags->'surface' AS surface + FROM + osm_water_lines_gen1 + WHERE + type IN ('river', 'canal', 'stream', 'ditch', 'drain', 'dam', 'cliff') + AND geometry && !BBOX! + """ + + [[providers.layers]] + geometry_fieldname = "geometry" + geometry_type = "linestring" + id_fieldname = "id" + name = "water_lines" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + tags->'bridge' AS bridge, + tags->'surface' AS surface, + tags->'start_date' AS start_date, + tags->'end_date' AS end_date, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_water_lines + WHERE + type IN ('river', 'canal', 'stream', 'ditch', 'drain', 'dam', 'cliff') + AND geometry && !BBOX! + """ + + ###### Water areas NE + ###### From config/providers/water_areas_ne.toml + [[providers.layers]] + name = "ne_water_lakes_0-2" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "ogc_fid" + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 1000),!BBOX!) AS geometry, name, ogc_fid FROM ne_50m_lakes WHERE wkb_geometry && !BBOX!" + + [[providers.layers]] + name = "ne_water_lakes_3-5" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "ogc_fid" + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 500),!BBOX!) AS geometry, name, ogc_fid FROM ne_50m_lakes WHERE wkb_geometry && !BBOX!" + + [[providers.layers]] + name = "ne_water_lakes_6-8" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "ogc_fid" + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 100),!BBOX!) AS geometry, name, ogc_fid FROM ne_10m_lakes WHERE wkb_geometry && !BBOX!" + + ###### Admin boundaries providers + ###### From config/providers/admin_boundaries_areas.toml + # Layer configuration for admin boundaries 0-2 + [[providers.layers]] + name = "admin_boundaries_0-2" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 500), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_admin_areas + WHERE + admin_level IN (1,2) + AND geometry && !BBOX! + """ + + # Layer configuration for admin boundaries 3-5 [[providers.layers]] - name = "landuse_areas_gen1" + name = "admin_boundaries_3-5" geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 200), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_admin_areas + WHERE + admin_level IN (1,2,3,4) + AND geometry && !BBOX! + """ + + # Layer configuration for admin boundaries 6-7 + [[providers.layers]] + name = "admin_boundaries_6-7" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 100), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_admin_areas + WHERE + admin_level IN (1,2,3,4,5,6) + AND geometry && !BBOX! + """ + + # Layer configuration for admin boundaries 8-9 + [[providers.layers]] + name = "admin_boundaries_8-9" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 50), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_admin_areas + WHERE + admin_level IN (1,2,3,4,5,6,7,8,9) + AND geometry && !BBOX! + """ + + # Layer configuration for admin boundaries 10-12 + [[providers.layers]] + name = "admin_boundaries_10-12" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 20), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_admin_areas + WHERE + admin_level IN (1,2,3,4,5,6,7,8,9,10) + AND geometry && !BBOX! + """ + + # Layer configuration for admin boundaries 13-15 + [[providers.layers]] + name = "admin_boundaries_13-15" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 5), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_admin_areas + WHERE + admin_level IN (1,2,3,4,5,6,7,8,9,10) + AND geometry && !BBOX! + """ + + # Layer configuration for admin boundaries 16-20 + [[providers.layers]] + name = "admin_boundaries_16-20" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 1), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_admin_areas + WHERE + admin_level IN (1,2,3,4,5,6,7,8,9,10) + AND geometry && !BBOX! + """ + + + ###### Land use areas + ###### From config/providers/landuse_areas.toml + # Layer 50,000,000 + [[providers.layers]] + name = "landuse_areas_gen0_3-5" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type, area FROM osm_landuse_areas_gen1 WHERE geometry && !BBOX!" - - # Transport + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 500), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + class, + type, + area + FROM + osm_landuse_areas_gen0 + WHERE + type IN ('forest', 'wood', 'nature reserve', 'nature_reserve', 'military') + AND area > 50000000 + AND geometry && !BBOX! + """ + + # Layer 1,000,000 [[providers.layers]] - name = "transport_points" + name = "landuse_areas_gen0_6-9" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type FROM osm_transport_points WHERE geometry && !BBOX!" - + sql = """ + SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 100), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + class, + type, + area + FROM + osm_landuse_areas_gen0 + WHERE + type IN ('forest', 'wood', 'nature reserve', 'nature_reserve', 'military') + AND area > 1000000 + AND geometry && !BBOX! + """ + + # Layer configuration for landuse areas gen1 [[providers.layers]] - name = "transport_areas" + name = "landuse_areas_gen1_10-12" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type FROM osm_transport_areas WHERE geometry && !BBOX!" - + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + class, + type, + area + FROM + osm_landuse_areas_gen1 + WHERE + geometry && !BBOX! + """ + # Layer configuration for landuse areas + [[providers.layers]] + name = "landuse_areas_13-20" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'wetland' AS wetland, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_landuse_areas + WHERE + geometry && !BBOX! + """ + + + ###### Land use lines and points + ###### From config/providers/landuse_lines.toml + # Layer configuration for landuse lines + [[providers.layers]] + name = "landuse_lines" + geometry_fieldname = "geometry" + geometry_type = "linestring" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_landuse_lines + WHERE + geometry && !BBOX! + """ + + ###### From config/providers/landuse_points.toml + # Layer configuration for landuse points + [[providers.layers]] + name = "landuse_points" + geometry_fieldname = "geometry" + geometry_type = "point" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_landuse_points + WHERE + geometry && !BBOX! + """ + + + ###### Transport lines, points and areas from ways + ###### From config/providers/transport_points.toml + # Layer configuration for transport points + [[providers.layers]] + name = "transport_points" + geometry_fieldname = "geometry" + geometry_type = "point" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_transport_points + WHERE + geometry && !BBOX! + """ + + ###### From config/providers/transport_lines.toml + # Layer configuration for transport lines gen0 [[providers.layers]] name = "transport_lines_gen0" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, type, tunnel, bridge, ref FROM osm_transport_lines_gen0 WHERE type IN ('motorway','trunk','motorway_link','trunk_link','primary') AND tunnel = 0 AND bridge = 0 AND geometry && !BBOX!" - + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + type, + tunnel, + bridge, + ref, + service, + tags->'electrified' AS electrified, + tags->'highspeed' AS highspeed, + tags->'usage' AS usage + FROM + osm_transport_lines_gen0 + WHERE + type IN ('motorway', 'trunk', 'motorway_link', 'trunk_link', 'primary') + AND tunnel = 0 + AND bridge = 0 + AND geometry && !BBOX! + """ + + # Layer configuration for transport lines gen1 [[providers.layers]] name = "transport_lines_gen1" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, ref, class, type FROM osm_transport_lines_gen1 WHERE type IN ('motorway', 'trunk', 'primary', 'primary_link', 'secondary', 'motorway_link', 'trunk_link') AND geometry && !BBOX!" - + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + ref, + class, + type, + service, + tags->'electrified' AS electrified, + tags->'highspeed' AS highspeed, + tags->'usage' AS usage + FROM + osm_transport_lines_gen1 + WHERE + type IN ( + 'motorway', 'trunk', 'primary', 'primary_link', 'secondary', + 'motorway_link', 'trunk_link', 'rail', 'subway', 'light_rail', + 'tram', 'narrow_gauge', 'monorail', 'preserved', 'miniature', + 'funicular', 'taxiway', 'runway', 'proposed', 'construction', + 'disused', 'abandoned', 'razed', 'ferry' + ) + AND geometry && !BBOX! + """ + + # Layer configuration for transport lines 11-12 [[providers.layers]] name = "transport_lines_11-12" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, ref, class, type, tunnel, bridge, access, service FROM osm_transport_lines WHERE type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'rail', 'taxiway', 'runway', 'apron') AND geometry && !BBOX!" - + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + ref, + class, + type, + tunnel, + bridge, + access, + service, + ford, + tags->'construction' AS construction, + tags->'electrified' AS electrified, + tags->'highspeed' AS highspeed, + tags->'usage' AS usage + FROM + osm_transport_lines + WHERE + type IN ( + 'motorway', 'motorway_link', 'trunk', 'trunk_link', + 'primary', 'primary_link', 'secondary', 'secondary_link', + 'tertiary', 'tertiary_link', 'rail', 'subway', 'light_rail', + 'tram', 'narrow_gauge', 'monorail', 'preserved', 'miniature', + 'funicular', 'taxiway', 'runway', 'proposed', 'construction', + 'disused', 'abandoned', 'razed', 'apron', 'ferry' + ) + AND geometry && !BBOX! + """ + + # Layer configuration for transport lines 13 [[providers.layers]] name = "transport_lines_13" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, ref, class, type, tunnel, bridge, access, service FROM osm_transport_lines WHERE type IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'rail', 'residential', 'taxiway', 'runway', 'apron') AND geometry && !BBOX!" - + geometry_type = "linestring" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + ref, + class, + type, + tunnel, + bridge, + access, + service, + ford, + tags->'construction' AS construction, + tags->'electrified' AS electrified, + tags->'highspeed' AS highspeed, + tags->'usage' AS usage + FROM + osm_transport_lines + WHERE + type IN ( + 'motorway', 'motorway_link', 'trunk', 'trunk_link', + 'primary', 'primary_link', 'secondary', 'secondary_link', + 'tertiary', 'tertiary_link', 'rail', 'subway', 'light_rail', + 'tram', 'narrow_gauge', 'monorail', 'preserved', + 'miniature', 'funicular', 'taxiway', 'runway', 'residential', + 'taxiway', 'runway', 'proposed', 'construction', 'disused', + 'abandoned', 'razed', 'apron', 'ferry' + ) + AND geometry && !BBOX! + """ + + # Layer configuration for transport lines 14-20 [[providers.layers]] name = "transport_lines_14-20" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, ref, class, type, tunnel, bridge, access, service FROM osm_transport_lines WHERE geometry && !BBOX!" - - # Amenities + geometry_type = "linestring" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + ref, + class, + type, + tunnel, + bridge, + access, + service, + ford, + tags->'construction' AS construction, + tags->'usage' AS usage, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_transport_lines + WHERE + geometry && !BBOX! + """ + + ###### From config/providers/transport_areas.toml + [[providers.layers]] + name = "transport_areas" + geometry_fieldname = "geometry" + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_transport_areas + WHERE + geometry && !BBOX! + """ + + + ###### Amenities areas and points + ###### From config/providers/amenity_areas.toml + # Layer configuration for amenity areas [[providers.layers]] name = "amenity_areas" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, type FROM osm_amenity_areas WHERE geometry && !BBOX!" - + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_amenity_areas + WHERE + geometry && !BBOX! + """ + + ###### From config/providers/amenity_points.toml + # Layer configuration for amenity points [[providers.layers]] name = "amenity_points" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, type FROM osm_amenity_points WHERE geometry && !BBOX!" - - # Other (Man Made, Historic, Military, Power, Barrier etc) + geometry_type = "point" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_amenity_points + WHERE + geometry && !BBOX! + """ + + + ###### Place points and areas + ###### From config/providers/place_points.toml + # Layer configuration for place points [[providers.layers]] - name = "other_points" + name = "place_points" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type FROM osm_other_points WHERE geometry && !BBOX!" - + geometry_type = "point" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + tags->'capital' AS capital, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_place_points + WHERE + geometry && !BBOX! + """ + + ###### From config/providers/place_areas.toml + # Layer configuration for place areas [[providers.layers]] - name = "other_lines" + name = "place_areas" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type FROM osm_other_lines WHERE geometry && !BBOX!" - + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_place_areas + WHERE + geometry && !BBOX! + """ + + + ###### Other (Man Made, Historic, Military, Power, Barrier etc) + ###### From config/providers/other_points.toml + # Layer configuration for other points [[providers.layers]] - name = "other_areas" + name = "other_points" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type FROM osm_other_areas WHERE geometry && !BBOX!" - + geometry_type = "point" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'artwork_type' AS artwork_type, + tags->'site_type' AS site_type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_other_points + WHERE + geometry && !BBOX! + """ + + ###### From config/providers/other_lines.toml + # Layer configuration for other lines [[providers.layers]] - name = "other_areas_filter" + name = "other_lines" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, class, type FROM osm_other_areas WHERE area > 1000000 AND geometry && !BBOX!" - - # Buildings + geometry_type = "linestring" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_other_lines + WHERE + geometry && !BBOX! + """ + + ###### From config/providers/other_areas.toml [[providers.layers]] - name = "buildings" + name = "other_areas_6-8" geometry_fieldname = "geometry" - id_fieldname = "osm_id" - sql = "SELECT ST_AsBinary(geometry) AS geometry, osm_id, name, nullif(as_numeric(height),-1) AS height, type FROM osm_buildings WHERE geometry && !BBOX!" - -# Natural Earth -[[providers]] -name = "ne" -type = "postgis" -host = "${POSTGRES_HOST}" -port = 5432 -database = "${POSTGRES_DB}" -user = "${POSTGRES_USER}" -password = "${POSTGRES_PASSWORD}" -srid = 3857 -max_connections = 40 - + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type + FROM + osm_other_areas + WHERE + area > 1000000 + AND geometry && !BBOX! + """ + [[providers.layers]] - name = "ne_110m_populated_places" + name = "other_areas_9-11" geometry_fieldname = "geometry" - id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, scalerank, labelrank, name, min_zoom, featurecla, rank_max FROM ne_110m_populated_places WHERE wkb_geometry && !BBOX!" - + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type + FROM + osm_other_areas + WHERE + area > 100000 + AND geometry && !BBOX! + """ + [[providers.layers]] - name = "ne_50m_populated_places" + name = "other_areas_12-14" geometry_fieldname = "geometry" - id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, scalerank, labelrank, name, min_zoom, featurecla, rank_max FROM ne_50m_populated_places WHERE wkb_geometry && !BBOX!" - + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type + FROM + osm_other_areas + WHERE + area > 10000 + AND geometry && !BBOX! + """ + [[providers.layers]] - name = "ne_10m_populated_places" + name = "other_areas_15-20" geometry_fieldname = "geometry" - id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, scalerank, labelrank, name, min_zoom, featurecla, rank_max FROM ne_10m_populated_places WHERE wkb_geometry && !BBOX!" - + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_other_areas + WHERE + geometry && !BBOX! + """ + + ###### Buildings + ###### From config/providers/buildings.toml + # Layer configuration for buildings [[providers.layers]] - name = "ne_10m_admin_0_label_points" + name = "buildings" geometry_fieldname = "geometry" - id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, sr_subunit, scalerank FROM ne_10m_admin_0_label_points WHERE wkb_geometry && !BBOX!" - + geometry_type = "multipolygon" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + nullif(as_numeric(height), -1) AS height, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_buildings + WHERE + geometry && !BBOX! + """ + + + ###### transport_associated_streets + ###### From config/providers/transport_associated_streets.toml + # Layer configuration for transport associated streets [[providers.layers]] - name = "ne_10m_admin_1_label_points" + name = "transport_associated_streets" geometry_fieldname = "geometry" - id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, name, scalerank FROM ne_10m_admin_1_label_points WHERE wkb_geometry && !BBOX!" + geometry_type = "LineString" + id_fieldname = "id" + sql = """ + SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + r.id, + m.member, + r.osm_id, + m.name, + m.relname, + m.index, + r.type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy + FROM + osm_relations r, + osm_relation_members m + WHERE + r.osm_id = m.osm_id + AND r.type = 'associatedStreet' + AND geometry && !BBOX! + """ + + +# Natural Earth (ne) +[[providers]] +name = "ne" +type = "mvt_postgis" +uri = "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" +# srid = 3857 +max_connections = 200 + ###### Admin lines ne + ###### From config/providers/admin_ne.toml [[providers.layers]] name = "ne_110m_admin_0_boundary_lines_land" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, min_zoom FROM ne_110m_admin_0_boundary_lines_land WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom + FROM ne_110m_admin_0_boundary_lines_land + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] name = "ne_50m_admin_0_boundary_lines_land" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, min_zoom FROM ne_50m_admin_0_boundary_lines_land WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom + FROM ne_50m_admin_0_boundary_lines_land + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] name = "ne_10m_admin_0_boundary_lines_land" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, min_zoom FROM ne_10m_admin_0_boundary_lines_land WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom + FROM ne_10m_admin_0_boundary_lines_land + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] name = "ne_50m_admin_0_boundary_lines_disputed_areas" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, min_zoom FROM ne_50m_admin_0_boundary_lines_disputed_areas WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom + FROM ne_50m_admin_0_boundary_lines_disputed_areas + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] name = "ne_10m_admin_0_boundary_lines_disputed_areas" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, min_zoom FROM ne_10m_admin_0_boundary_lines_disputed_areas WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom + FROM ne_10m_admin_0_boundary_lines_disputed_areas + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] name = "ne_110m_admin_0_countries" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, name_long, abbrev, adm0_a3, min_zoom, min_label, max_label FROM ne_110m_admin_0_countries WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, name_long, abbrev, adm0_a3, min_zoom, min_label, max_label + FROM ne_110m_admin_0_countries + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] name = "ne_50m_admin_0_countries" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, name_long, abbrev, adm0_a3, min_zoom, min_label, max_label FROM ne_50m_admin_0_countries WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, name_long, abbrev, adm0_a3, min_zoom, min_label, max_label + FROM ne_50m_admin_0_countries + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] name = "ne_10m_admin_0_countries" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, name_long, abbrev, adm0_a3, min_zoom, min_label, max_label FROM ne_10m_admin_0_countries WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, name_long, abbrev, adm0_a3, min_zoom, min_label, max_label + FROM ne_10m_admin_0_countries + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] name = "ne_110m_admin_1_states_provinces_lines" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, adm0_name, min_zoom FROM ne_110m_admin_1_states_provinces_lines WHERE wkb_geometry && !BBOX!" - - [[providers.layers]] + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, adm0_name, min_zoom + FROM ne_110m_admin_1_states_provinces_lines + WHERE wkb_geometry && !BBOX! + """ + + [[providers.layers]] name = "ne_50m_admin_1_states_provinces_lines" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, adm0_name, min_zoom FROM ne_50m_admin_1_states_provinces_lines WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, adm0_name, min_zoom + FROM ne_50m_admin_1_states_provinces_lines + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] name = "ne_10m_admin_1_states_provinces_lines" geometry_fieldname = "geometry" + geometry_type = "linestring" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, adm0_name, min_zoom, min_label FROM ne_10m_admin_1_states_provinces_lines WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, adm0_name, min_zoom, min_label + FROM ne_10m_admin_1_states_provinces_lines + WHERE wkb_geometry && !BBOX! + """ + [[providers.layers]] - name = "ne_110m_land" - geometry_fieldname = "geometry" - id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, min_zoom FROM ne_110m_land WHERE wkb_geometry && !BBOX!" - - [[providers.layers]] - name = "ne_50m_land" - geometry_fieldname = "geometry" - id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, min_zoom FROM ne_50m_land WHERE wkb_geometry && !BBOX!" - - [[providers.layers]] - name = "ne_10m_land" + name = "ne_10m_admin_0_label_points" geometry_fieldname = "geometry" + geometry_type = "point" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, min_zoom FROM ne_10m_land WHERE wkb_geometry && !BBOX!" - + sql = """ + SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, sr_subunit, scalerank + FROM ne_10m_admin_0_label_points + WHERE wkb_geometry && !BBOX! + """ + ###### Water lands ne + ###### From config/providers/water_areas_ne.toml [[providers.layers]] - name = "ne_50m_admin_1_states_provinces_lakes" + name = "ne_water_lakes_0-2" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, featurecla, name, postal, min_zoom, min_label FROM ne_50m_admin_1_states_provinces_lakes WHERE wkb_geometry && !BBOX!" - + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 1000),!BBOX!) AS geometry, name, ogc_fid FROM ne_50m_lakes WHERE wkb_geometry && !BBOX!" + [[providers.layers]] - name = "ne_10m_roads_3" + name = "ne_water_lakes_3-5" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, name, min_zoom, min_label, type, label FROM ne_10m_roads WHERE min_zoom < 5 AND type <> 'Ferry Route' AND wkb_geometry && !BBOX!" - + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 500),!BBOX!) AS geometry, name, ogc_fid FROM ne_50m_lakes WHERE wkb_geometry && !BBOX!" + [[providers.layers]] - name = "ne_10m_roads_5" + name = "ne_water_lakes_6-8" geometry_fieldname = "geometry" + geometry_type = "multipolygon" id_fieldname = "ogc_fid" - sql = "SELECT ST_AsBinary(wkb_geometry) AS geometry, ogc_fid, name, min_zoom, min_label, type, label FROM ne_10m_roads WHERE min_zoom <= 7 AND type <> 'Ferry Route' AND wkb_geometry && !BBOX!" - + sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 100),!BBOX!) AS geometry, name, ogc_fid FROM ne_10m_lakes WHERE wkb_geometry && !BBOX!" + [[maps]] name = "osm" -attribution = "OpenStreetMap" # map attribution -center = [-74.275329586789, -12.153492567373, 8.0] # optional center value. part of the TileJSON spec - +attribution = "OpenStreetMap" +center = [-74.275329586789, -12.153492567373, 8.0] + ###### Land + ###### From config/providers/land.zoom.toml [[maps.layers]] - name = "populated_places" - provider_layer = "ne.ne_110m_populated_places" + name = "land" + provider_layer = "osm.land_0-2" min_zoom = 0 max_zoom = 2 - + [[maps.layers]] - name = "populated_places" - provider_layer = "ne.ne_50m_populated_places" + name = "land" + provider_layer = "osm.land_3-5" min_zoom = 3 - max_zoom = 4 - - [[maps.layers]] - name = "populated_places" - provider_layer = "ne.ne_10m_populated_places" - min_zoom = 5 - max_zoom = 20 - - [[maps.layers]] - name = "country_lines" - provider_layer = "ne.ne_110m_admin_0_boundary_lines_land" - min_zoom = 0 - max_zoom = 2 - + max_zoom = 5 + [[maps.layers]] - name = "country_lines" - provider_layer = "ne.ne_50m_admin_0_boundary_lines_land" - dont_simplify = true - min_zoom = 3 - max_zoom = 4 - + name = "land" + provider_layer = "osm.land_6-7" + min_zoom = 6 + max_zoom = 7 + [[maps.layers]] - name = "country_lines" - provider_layer = "ne.ne_10m_admin_0_boundary_lines_land" - min_zoom = 5 - max_zoom = 10 - + name = "land" + provider_layer = "osm.land_8-9" + min_zoom = 8 + max_zoom = 9 + [[maps.layers]] - name = "country_lines_disputed" - provider_layer = "ne.ne_50m_admin_0_boundary_lines_disputed_areas" - min_zoom = 3 - max_zoom = 4 - + name = "land" + provider_layer = "osm.land_10-12" + min_zoom = 10 + max_zoom = 12 + [[maps.layers]] - name = "country_lines_disputed" - provider_layer = "ne.ne_10m_admin_0_boundary_lines_disputed_areas" - min_zoom = 5 - max_zoom = 10 - + name = "land" + provider_layer = "osm.land_13-15" + min_zoom = 13 + max_zoom = 15 + [[maps.layers]] - name = "country_label_points" - provider_layer = "ne.ne_10m_admin_0_label_points" - min_zoom = 3 + name = "land" + provider_layer = "osm.land_16-20" + min_zoom = 16 max_zoom = 20 + + + + ##### Admin boundaries display zooms + ###### From config/providers/admin_boundaries_areas.zoom.toml + # Admin Bounduaries Areas [[maps.layers]] - name = "country_polygons" - provider_layer = "ne.ne_110m_admin_0_countries" - min_zoom = 0 - max_zoom = 2 - - [[maps.layers]] - name = "country_polygons" - provider_layer = "ne.ne_50m_admin_0_countries" - min_zoom = 3 - max_zoom = 4 - - [[maps.layers]] - name = "country_polygons" - provider_layer = "ne.ne_10m_admin_0_countries" - min_zoom = 5 - max_zoom = 10 - - [[maps.layers]] - name = "state_lines" - provider_layer = "ne.ne_110m_admin_1_states_provinces_lines" + name = "land_osm" + provider_layer = "osm.admin_boundaries_0-2" min_zoom = 0 max_zoom = 2 - + [[maps.layers]] - name = "state_lines" - provider_layer = "ne.ne_50m_admin_1_states_provinces_lines" - min_zoom = 3 - max_zoom = 4 - - [[maps.layers]] - name = "state_lines" - provider_layer = "ne.ne_10m_admin_1_states_provinces_lines" - min_zoom = 5 - max_zoom = 10 - - # Land Polygons - [[maps.layers]] - name = "land" - provider_layer = "ne.ne_110m_land" - min_zoom = 0 - max_zoom = 2 - - [[maps.layers]] - name = "land" - provider_layer = "ne.ne_50m_land" + name = "land_osm" + provider_layer = "osm.admin_boundaries_3-5" min_zoom = 3 - max_zoom = 4 - + max_zoom = 5 + [[maps.layers]] - name = "land" - provider_layer = "ne.ne_10m_land" - min_zoom = 5 + name = "land_osm" + provider_layer = "osm.admin_boundaries_6-7" + min_zoom = 6 max_zoom = 7 - + [[maps.layers]] - name = "land" - provider_layer = "osm.land_8-20" - dont_simplify = true + name = "land_osm" + provider_layer = "osm.admin_boundaries_8-9" min_zoom = 8 - max_zoom = 20 - + max_zoom = 9 + [[maps.layers]] - name = "admin_lines" - provider_layer = "osm.admin_boundaries_8-12" - min_zoom = 8 + name = "land_osm" + provider_layer = "osm.admin_boundaries_10-12" + min_zoom = 10 max_zoom = 12 - + [[maps.layers]] - name = "admin_lines" - provider_layer = "osm.admin_boundaries_13-20" + name = "land_osm" + provider_layer = "osm.admin_boundaries_13-15" min_zoom = 13 - max_zoom = 20 - + max_zoom = 15 + [[maps.layers]] - name = "state_label_points" - provider_layer = "ne.ne_10m_admin_1_label_points" - min_zoom = 3 + name = "land_osm" + provider_layer = "osm.admin_boundaries_16-20" + min_zoom = 16 max_zoom = 20 - # Land Use + ###### Land Use + ###### From config/providers/landuse_areas.zoom.toml [[maps.layers]] name = "landuse_areas" - provider_layer = "osm.landuse_areas_gen0" + provider_layer = "osm.landuse_areas_gen0_3-5" min_zoom = 3 max_zoom = 5 - + [[maps.layers]] name = "landuse_areas" - provider_layer = "osm.landuse_areas_gen0_6" + provider_layer = "osm.landuse_areas_gen0_6-9" min_zoom = 6 max_zoom = 9 - + [[maps.layers]] name = "landuse_areas" - provider_layer = "osm.landuse_areas_gen1" + provider_layer = "osm.landuse_areas_gen1_10-12" min_zoom = 10 max_zoom = 12 - + [[maps.layers]] name = "landuse_areas" - provider_layer = "osm.landuse_areas" + provider_layer = "osm.landuse_areas_13-20" min_zoom = 13 max_zoom = 20 + + ###### From config/providers/landuse_lines.zoom.toml + [[maps.layers]] + name = "landuse_lines" + provider_layer = "osm.landuse_lines" + min_zoom = 14 + max_zoom = 20 + ###### From config/providers/landuse_points.zoom.toml + [[maps.layers]] + name = "landuse_points" + provider_layer = "osm.landuse_points" + min_zoom = 6 + max_zoom = 20 - # Water Areas + ###### Water areas/lines + ###### From config/providers/water_areas.zoom.toml [[maps.layers]] name = "water_areas" - provider_layer = "osm.water_areas_gen0" + provider_layer = "osm.water_areas_gen0_0-2" + min_zoom = 0 + max_zoom = 2 + + [[maps.layers]] + name = "water_areas" + provider_layer = "osm.water_areas_gen0_3-5" min_zoom = 3 max_zoom = 5 - + [[maps.layers]] name = "water_areas" - provider_layer = "osm.water_areas_gen0_6" + provider_layer = "osm.water_areas_gen0_6-7" min_zoom = 6 + max_zoom = 7 + + [[maps.layers]] + name = "water_areas" + provider_layer = "osm.water_areas_gen0_8-9" + min_zoom = 8 max_zoom = 9 - + [[maps.layers]] name = "water_areas" - provider_layer = "osm.water_areas_gen1" + provider_layer = "osm.water_areas_gen1_10-12" min_zoom = 10 max_zoom = 12 - + [[maps.layers]] name = "water_areas" - provider_layer = "osm.water_areas" + provider_layer = "osm.water_areas_13-15" min_zoom = 13 + max_zoom = 15 + + [[maps.layers]] + name = "water_areas" + provider_layer = "osm.water_areas_16-20" + min_zoom = 16 max_zoom = 20 - - # Water Lines + ###### From config/providers/water_lines.zoom.toml [[maps.layers]] name = "water_lines" - provider_layer = "osm.water_lines_gen0" + provider_layer = "osm.water_lines_gen0_6-6" + min_zoom = 6 + max_zoom = 6 + + [[maps.layers]] + name = "water_lines" + provider_layer = "osm.water_lines_gen0_7-7" + min_zoom = 7 + max_zoom = 7 + + [[maps.layers]] + name = "water_lines" + provider_layer = "osm.water_lines_gen0_8-8" min_zoom = 8 - max_zoom = 12 - + max_zoom = 8 + [[maps.layers]] name = "water_lines" - provider_layer = "osm.water_lines_gen1" - min_zoom = 13 - max_zoom = 14 - + provider_layer = "osm.water_lines_gen0_9-9" + min_zoom = 9 + max_zoom = 9 + + [[maps.layers]] + name = "water_lines" + provider_layer = "osm.water_lines_gen1_10-11" + min_zoom = 10 + max_zoom = 11 + [[maps.layers]] name = "water_lines" provider_layer = "osm.water_lines" - min_zoom = 15 + min_zoom = 12 max_zoom = 20 # Transport Lines (Roads, Rail, Aviation) - [[maps.layers]] - name = "transport_lines" - provider_layer = "ne.ne_10m_roads_3" - min_zoom = 3 - max_zoom = 4 - - [[maps.layers]] - name = "transport_lines" - provider_layer = "ne.ne_10m_roads_5" - min_zoom = 5 - max_zoom = 6 - + ###### From config/providers/transport_lines.zoom.toml [[maps.layers]] name = "transport_lines" provider_layer = "osm.transport_lines_gen0" - min_zoom = 7 - max_zoom = 8 - + min_zoom = 3 + max_zoom = 5 + [[maps.layers]] name = "transport_lines" provider_layer = "osm.transport_lines_gen1" - min_zoom = 9 + min_zoom = 6 max_zoom = 10 - + [[maps.layers]] name = "transport_lines" provider_layer = "osm.transport_lines_11-12" min_zoom = 11 max_zoom = 12 - + [[maps.layers]] name = "transport_lines" provider_layer = "osm.transport_lines_13" min_zoom = 13 max_zoom = 13 - + [[maps.layers]] name = "transport_lines" provider_layer = "osm.transport_lines_14-20" min_zoom = 14 max_zoom = 20 + [['providers/route_lines.zoom.toml']] + + ###### admin_boundaries_maritime + [['providers/admin_boundaries_maritime.zoom.toml']] # Transport Areas [[maps.layers]] @@ -616,6 +1713,8 @@ center = [-74.275329586789, -12.153492567373, 8.0] # optional center value. part min_zoom = 14 max_zoom = 20 + + # Amenity Points [[maps.layers]] name = "amenity_points" @@ -623,6 +1722,20 @@ center = [-74.275329586789, -12.153492567373, 8.0] # optional center value. part min_zoom = 14 max_zoom = 20 + # Place Points + [[maps.layers]] + name = "place_points" + provider_layer = "osm.place_points" + min_zoom = 1 + max_zoom = 20 + + # Place areas + [[maps.layers]] + name = "place_areas" + provider_layer = "osm.place_areas" + min_zoom = 14 + max_zoom = 20 + # Other Points [[maps.layers]] name = "other_points" @@ -637,22 +1750,142 @@ center = [-74.275329586789, -12.153492567373, 8.0] # optional center value. part min_zoom = 14 max_zoom = 20 + # Other Areas + ###### From config/providers/other_areas.zoom.toml # Other Areas [[maps.layers]] name = "other_areas" - provider_layer = "osm.other_areas_filter" + provider_layer = "osm.other_areas_6-8" min_zoom = 6 max_zoom = 8 - + [[maps.layers]] name = "other_areas" - provider_layer = "osm.other_areas" + provider_layer = "osm.other_areas_9-11" min_zoom = 9 + max_zoom = 11 + + [[maps.layers]] + name = "other_areas" + provider_layer = "osm.other_areas_12-14" + min_zoom = 12 + max_zoom = 14 + + [[maps.layers]] + name = "other_areas" + provider_layer = "osm.other_areas_15-20" + min_zoom = 15 max_zoom = 20 + # Buildings [[maps.layers]] name = "buildings" provider_layer = "osm.buildings" min_zoom = 14 - max_zoom = 20 \ No newline at end of file + max_zoom = 20 + + + [[maps.layers]] + name = "transport_associated_streets" + provider_layer = "osm.transport_associated_streets" + min_zoom = 7 + max_zoom = 20 + + +[[maps]] +name = "ne" +attribution = "Natural Earth" +center = [-74.275329586789, -12.153492567373, 8.0] + + ###### From config/providers/admin_ne.zoom.toml + [[maps.layers]] + name = "country_lines" + provider_layer = "ne.ne_110m_admin_0_boundary_lines_land" + min_zoom = 0 + max_zoom = 2 + + [[maps.layers]] + name = "country_lines" + provider_layer = "ne.ne_50m_admin_0_boundary_lines_land" + dont_simplify = true + min_zoom = 3 + max_zoom = 4 + + [[maps.layers]] + name = "country_lines" + provider_layer = "ne.ne_10m_admin_0_boundary_lines_land" + min_zoom = 5 + max_zoom = 10 + + [[maps.layers]] + name = "country_lines_disputed" + provider_layer = "ne.ne_50m_admin_0_boundary_lines_disputed_areas" + min_zoom = 3 + max_zoom = 4 + + [[maps.layers]] + name = "country_lines_disputed" + provider_layer = "ne.ne_10m_admin_0_boundary_lines_disputed_areas" + min_zoom = 5 + max_zoom = 10 + + [[maps.layers]] + name = "country_label_points" + provider_layer = "ne.ne_10m_admin_0_label_points" + min_zoom = 3 + max_zoom = 20 + + [[maps.layers]] + name = "country_polygons" + provider_layer = "ne.ne_110m_admin_0_countries" + min_zoom = 0 + max_zoom = 2 + + [[maps.layers]] + name = "country_polygons" + provider_layer = "ne.ne_50m_admin_0_countries" + min_zoom = 3 + max_zoom = 4 + + [[maps.layers]] + name = "country_polygons" + provider_layer = "ne.ne_10m_admin_0_countries" + min_zoom = 5 + max_zoom = 10 + + [[maps.layers]] + name = "state_lines" + provider_layer = "ne.ne_110m_admin_1_states_provinces_lines" + min_zoom = 0 + max_zoom = 2 + + [[maps.layers]] + name = "state_lines" + provider_layer = "ne.ne_50m_admin_1_states_provinces_lines" + min_zoom = 3 + max_zoom = 4 + + [[maps.layers]] + name = "state_lines" + provider_layer = "ne.ne_10m_admin_1_states_provinces_lines" + min_zoom = 5 + max_zoom = 10 + # Water lakes Natural Earth + [[maps.layers]] + name = "water_areas" + provider_layer = "ne.ne_water_lakes_0-2" + min_zoom = 0 + max_zoom = 2 + + [[maps.layers]] + name = "water_areas" + provider_layer = "ne.ne_water_lakes_3-5" + min_zoom = 3 + max_zoom = 5 + + [[maps.layers]] + name = "water_areas" + provider_layer = "ne.ne_water_lakes_6-8" + min_zoom = 6 + max_zoom = 8 diff --git a/images/tiler-server/config/providers/admin_boundaries_areas.toml b/images/tiler-server/config/providers/admin_boundaries_areas.toml new file mode 100644 index 00000000..0c6a1e88 --- /dev/null +++ b/images/tiler-server/config/providers/admin_boundaries_areas.toml @@ -0,0 +1,181 @@ +# Layer configuration for admin boundaries 0-2 +[[providers.layers]] +name = "admin_boundaries_0-2" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 500), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_admin_areas +WHERE + admin_level IN (1,2) + AND geometry && !BBOX! +""" + +# Layer configuration for admin boundaries 3-5 +[[providers.layers]] +name = "admin_boundaries_3-5" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 200), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_admin_areas +WHERE + admin_level IN (1,2,3,4) + AND geometry && !BBOX! +""" + +# Layer configuration for admin boundaries 6-7 +[[providers.layers]] +name = "admin_boundaries_6-7" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 100), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_admin_areas +WHERE + admin_level IN (1,2,3,4,5,6) + AND geometry && !BBOX! +""" + +# Layer configuration for admin boundaries 8-9 +[[providers.layers]] +name = "admin_boundaries_8-9" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 50), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_admin_areas +WHERE + admin_level IN (1,2,3,4,5,6,7,8,9) + AND geometry && !BBOX! +""" + +# Layer configuration for admin boundaries 10-12 +[[providers.layers]] +name = "admin_boundaries_10-12" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 20), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_admin_areas +WHERE + admin_level IN (1,2,3,4,5,6,7,8,9,10) + AND geometry && !BBOX! +""" + +# Layer configuration for admin boundaries 13-15 +[[providers.layers]] +name = "admin_boundaries_13-15" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 5), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_admin_areas +WHERE + admin_level IN (1,2,3,4,5,6,7,8,9,10) + AND geometry && !BBOX! +""" + +# Layer configuration for admin boundaries 16-20 +[[providers.layers]] +name = "admin_boundaries_16-20" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 1), !BBOX!) AS geometry, + id, + osm_id, + admin_level, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_admin_areas +WHERE + admin_level IN (1,2,3,4,5,6,7,8,9,10) + AND geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/admin_boundaries_areas.zoom.toml b/images/tiler-server/config/providers/admin_boundaries_areas.zoom.toml new file mode 100644 index 00000000..efcc9758 --- /dev/null +++ b/images/tiler-server/config/providers/admin_boundaries_areas.zoom.toml @@ -0,0 +1,42 @@ +# Admin Bounduaries Areas +[[maps.layers]] +name = "land_osm" +provider_layer = "osm.admin_boundaries_0-2" +min_zoom = 0 +max_zoom = 2 + +[[maps.layers]] +name = "land_osm" +provider_layer = "osm.admin_boundaries_3-5" +min_zoom = 3 +max_zoom = 5 + +[[maps.layers]] +name = "land_osm" +provider_layer = "osm.admin_boundaries_6-7" +min_zoom = 6 +max_zoom = 7 + +[[maps.layers]] +name = "land_osm" +provider_layer = "osm.admin_boundaries_8-9" +min_zoom = 8 +max_zoom = 9 + +[[maps.layers]] +name = "land_osm" +provider_layer = "osm.admin_boundaries_10-12" +min_zoom = 10 +max_zoom = 12 + +[[maps.layers]] +name = "land_osm" +provider_layer = "osm.admin_boundaries_13-15" +min_zoom = 13 +max_zoom = 15 + +[[maps.layers]] +name = "land_osm" +provider_layer = "osm.admin_boundaries_16-20" +min_zoom = 16 +max_zoom = 20 \ No newline at end of file diff --git a/images/tiler-server/config/providers/admin_ne.toml b/images/tiler-server/config/providers/admin_ne.toml new file mode 100644 index 00000000..6a7a757e --- /dev/null +++ b/images/tiler-server/config/providers/admin_ne.toml @@ -0,0 +1,131 @@ +[[providers.layers]] +name = "ne_110m_admin_0_boundary_lines_land" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom +FROM ne_110m_admin_0_boundary_lines_land +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_50m_admin_0_boundary_lines_land" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom +FROM ne_50m_admin_0_boundary_lines_land +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_10m_admin_0_boundary_lines_land" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom +FROM ne_10m_admin_0_boundary_lines_land +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_50m_admin_0_boundary_lines_disputed_areas" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom +FROM ne_50m_admin_0_boundary_lines_disputed_areas +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_10m_admin_0_boundary_lines_disputed_areas" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, min_zoom +FROM ne_10m_admin_0_boundary_lines_disputed_areas +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_110m_admin_0_countries" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, name_long, abbrev, adm0_a3, min_zoom, min_label, max_label +FROM ne_110m_admin_0_countries +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_50m_admin_0_countries" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, name_long, abbrev, adm0_a3, min_zoom, min_label, max_label +FROM ne_50m_admin_0_countries +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_10m_admin_0_countries" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, name_long, abbrev, adm0_a3, min_zoom, min_label, max_label +FROM ne_10m_admin_0_countries +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_110m_admin_1_states_provinces_lines" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, adm0_name, min_zoom +FROM ne_110m_admin_1_states_provinces_lines +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_50m_admin_1_states_provinces_lines" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, adm0_name, min_zoom +FROM ne_50m_admin_1_states_provinces_lines +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_10m_admin_1_states_provinces_lines" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, featurecla, name, adm0_name, min_zoom, min_label +FROM ne_10m_admin_1_states_provinces_lines +WHERE wkb_geometry && !BBOX! +""" + +[[providers.layers]] +name = "ne_10m_admin_0_label_points" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "ogc_fid" +sql = """ +SELECT ST_AsMVTGeom(wkb_geometry, !BBOX!) AS geometry, ogc_fid, sr_subunit, scalerank +FROM ne_10m_admin_0_label_points +WHERE wkb_geometry && !BBOX! +""" \ No newline at end of file diff --git a/images/tiler-server/config/providers/admin_ne.zoom.toml b/images/tiler-server/config/providers/admin_ne.zoom.toml new file mode 100644 index 00000000..11457e3f --- /dev/null +++ b/images/tiler-server/config/providers/admin_ne.zoom.toml @@ -0,0 +1,72 @@ +[[maps.layers]] +name = "country_lines" +provider_layer = "ne.ne_110m_admin_0_boundary_lines_land" +min_zoom = 0 +max_zoom = 2 + +[[maps.layers]] +name = "country_lines" +provider_layer = "ne.ne_50m_admin_0_boundary_lines_land" +dont_simplify = true +min_zoom = 3 +max_zoom = 4 + +[[maps.layers]] +name = "country_lines" +provider_layer = "ne.ne_10m_admin_0_boundary_lines_land" +min_zoom = 5 +max_zoom = 10 + +[[maps.layers]] +name = "country_lines_disputed" +provider_layer = "ne.ne_50m_admin_0_boundary_lines_disputed_areas" +min_zoom = 3 +max_zoom = 4 + +[[maps.layers]] +name = "country_lines_disputed" +provider_layer = "ne.ne_10m_admin_0_boundary_lines_disputed_areas" +min_zoom = 5 +max_zoom = 10 + +[[maps.layers]] +name = "country_label_points" +provider_layer = "ne.ne_10m_admin_0_label_points" +min_zoom = 3 +max_zoom = 20 + +[[maps.layers]] +name = "country_polygons" +provider_layer = "ne.ne_110m_admin_0_countries" +min_zoom = 0 +max_zoom = 2 + +[[maps.layers]] +name = "country_polygons" +provider_layer = "ne.ne_50m_admin_0_countries" +min_zoom = 3 +max_zoom = 4 + +[[maps.layers]] +name = "country_polygons" +provider_layer = "ne.ne_10m_admin_0_countries" +min_zoom = 5 +max_zoom = 10 + +[[maps.layers]] +name = "state_lines" +provider_layer = "ne.ne_110m_admin_1_states_provinces_lines" +min_zoom = 0 +max_zoom = 2 + +[[maps.layers]] +name = "state_lines" +provider_layer = "ne.ne_50m_admin_1_states_provinces_lines" +min_zoom = 3 +max_zoom = 4 + +[[maps.layers]] +name = "state_lines" +provider_layer = "ne.ne_10m_admin_1_states_provinces_lines" +min_zoom = 5 +max_zoom = 10 \ No newline at end of file diff --git a/images/tiler-server/config/providers/amenity_areas.toml b/images/tiler-server/config/providers/amenity_areas.toml new file mode 100644 index 00000000..9f8548b6 --- /dev/null +++ b/images/tiler-server/config/providers/amenity_areas.toml @@ -0,0 +1,22 @@ +# Layer configuration for amenity areas +[[providers.layers]] +name = "amenity_areas" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_amenity_areas +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/amenity_points.toml b/images/tiler-server/config/providers/amenity_points.toml new file mode 100644 index 00000000..6467c1ad --- /dev/null +++ b/images/tiler-server/config/providers/amenity_points.toml @@ -0,0 +1,23 @@ +# Layer configuration for amenity points +[[providers.layers]] +name = "amenity_points" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_amenity_points +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/buildings.toml b/images/tiler-server/config/providers/buildings.toml new file mode 100644 index 00000000..eb10873c --- /dev/null +++ b/images/tiler-server/config/providers/buildings.toml @@ -0,0 +1,24 @@ +# Layer configuration for buildings +[[providers.layers]] +name = "buildings" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + nullif(as_numeric(height), -1) AS height, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_buildings +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/land.toml b/images/tiler-server/config/providers/land.toml new file mode 100644 index 00000000..ce3a4b56 --- /dev/null +++ b/images/tiler-server/config/providers/land.toml @@ -0,0 +1,57 @@ +# Simplification for geometries +# Zoom levels 0-2,Tolerance=500 => ~1000 meters +# Zoom levels 3-5,Tolerance=200=> ~500 meters +# Zoom levels 6-7,Tolerance=100=> ~200 meters +# Zoom levels 8-9,Tolerance=50=> ~100 meters +# Zoom levels 10-12,Tolerance=20=> ~50 meters +# Zoom levels 13-15,Tolerance=5=> ~20 meters +# Zoom levels 16-20,Tolerance=1=> ~5 meters + +[[providers.layers]] +name = "land_0-2" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 500),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + +[[providers.layers]] +name = "land_3-5" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 200),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + +[[providers.layers]] +name = "land_6-7" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 70),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + +[[providers.layers]] +name = "land_8-9" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 30),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + +[[providers.layers]] +name = "land_10-12" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 10),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + +[[providers.layers]] +name = "land_13-15" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 5),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" + +[[providers.layers]] +name = "land_16-20" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 1),!BBOX!) AS geometry, ogc_fid FROM land_polygons WHERE wkb_geometry && !BBOX!" diff --git a/images/tiler-server/config/providers/land.zoom.toml b/images/tiler-server/config/providers/land.zoom.toml new file mode 100644 index 00000000..17ec984c --- /dev/null +++ b/images/tiler-server/config/providers/land.zoom.toml @@ -0,0 +1,43 @@ +[[maps.layers]] +name = "land" +provider_layer = "osm.land_0-2" +min_zoom = 0 +max_zoom = 2 + +[[maps.layers]] +name = "land" +provider_layer = "osm.land_3-5" +min_zoom = 3 +max_zoom = 5 + +[[maps.layers]] +name = "land" +provider_layer = "osm.land_6-7" +min_zoom = 6 +max_zoom = 7 + +[[maps.layers]] +name = "land" +provider_layer = "osm.land_8-9" +min_zoom = 8 +max_zoom = 9 + +[[maps.layers]] +name = "land" +provider_layer = "osm.land_10-12" +min_zoom = 10 +max_zoom = 12 + +[[maps.layers]] +name = "land" +provider_layer = "osm.land_13-15" +min_zoom = 13 +max_zoom = 15 + +[[maps.layers]] +name = "land" +provider_layer = "osm.land_16-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 new file mode 100644 index 00000000..0f262ce2 --- /dev/null +++ b/images/tiler-server/config/providers/landuse_areas.toml @@ -0,0 +1,89 @@ +# Layer 50,000,000 +[[providers.layers]] +name = "landuse_areas_gen0_3-5" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 500), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + class, + type, + area +FROM + osm_landuse_areas_gen0 +WHERE + type IN ('forest', 'wood', 'nature reserve', 'nature_reserve', 'military') + AND area > 50000000 + AND geometry && !BBOX! +""" + +# Layer 1,000,000 +[[providers.layers]] +name = "landuse_areas_gen0_6-9" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 100), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + class, + type, + area +FROM + osm_landuse_areas_gen0 +WHERE + type IN ('forest', 'wood', 'nature reserve', 'nature_reserve', 'military') + AND area > 1000000 + AND geometry && !BBOX! +""" + +# Layer configuration for landuse areas gen1 +[[providers.layers]] +name = "landuse_areas_gen1_10-12" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + class, + type, + area +FROM + osm_landuse_areas_gen1 +WHERE + geometry && !BBOX! +""" +# Layer configuration for landuse areas +[[providers.layers]] +name = "landuse_areas_13-20" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'wetland' AS wetland, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_landuse_areas +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/landuse_areas.zoom.toml b/images/tiler-server/config/providers/landuse_areas.zoom.toml new file mode 100644 index 00000000..8a720542 --- /dev/null +++ b/images/tiler-server/config/providers/landuse_areas.zoom.toml @@ -0,0 +1,23 @@ +[[maps.layers]] +name = "landuse_areas" +provider_layer = "osm.landuse_areas_gen0_3-5" +min_zoom = 3 +max_zoom = 5 + +[[maps.layers]] +name = "landuse_areas" +provider_layer = "osm.landuse_areas_gen0_6-9" +min_zoom = 6 +max_zoom = 9 + +[[maps.layers]] +name = "landuse_areas" +provider_layer = "osm.landuse_areas_gen1_10-12" +min_zoom = 10 +max_zoom = 12 + +[[maps.layers]] +name = "landuse_areas" +provider_layer = "osm.landuse_areas_13-20" +min_zoom = 13 +max_zoom = 20 diff --git a/images/tiler-server/config/providers/landuse_lines.toml b/images/tiler-server/config/providers/landuse_lines.toml new file mode 100644 index 00000000..fee2c2ad --- /dev/null +++ b/images/tiler-server/config/providers/landuse_lines.toml @@ -0,0 +1,24 @@ +# Layer configuration for landuse lines +[[providers.layers]] +name = "landuse_lines" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_landuse_lines +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/landuse_lines.zoom.toml b/images/tiler-server/config/providers/landuse_lines.zoom.toml new file mode 100644 index 00000000..8a68b082 --- /dev/null +++ b/images/tiler-server/config/providers/landuse_lines.zoom.toml @@ -0,0 +1,5 @@ +[[maps.layers]] +name = "landuse_lines" +provider_layer = "osm.landuse_lines" +min_zoom = 14 +max_zoom = 20 \ No newline at end of file diff --git a/images/tiler-server/config/providers/landuse_points.toml b/images/tiler-server/config/providers/landuse_points.toml new file mode 100644 index 00000000..fdfac0bd --- /dev/null +++ b/images/tiler-server/config/providers/landuse_points.toml @@ -0,0 +1,24 @@ +# Layer configuration for landuse points +[[providers.layers]] +name = "landuse_points" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_landuse_points +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/landuse_points.zoom.toml b/images/tiler-server/config/providers/landuse_points.zoom.toml new file mode 100644 index 00000000..0bcb73dd --- /dev/null +++ b/images/tiler-server/config/providers/landuse_points.zoom.toml @@ -0,0 +1,5 @@ +[[maps.layers]] +name = "landuse_points" +provider_layer = "osm.landuse_points" +min_zoom = 6 +max_zoom = 20 \ No newline at end of file diff --git a/images/tiler-server/config/providers/other_areas.toml b/images/tiler-server/config/providers/other_areas.toml new file mode 100644 index 00000000..b4aa9137 --- /dev/null +++ b/images/tiler-server/config/providers/other_areas.toml @@ -0,0 +1,83 @@ +[[providers.layers]] +name = "other_areas_6-8" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type +FROM + osm_other_areas +WHERE + area > 1000000 + AND geometry && !BBOX! +""" + +[[providers.layers]] +name = "other_areas_9-11" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type +FROM + osm_other_areas +WHERE + area > 100000 + AND geometry && !BBOX! +""" + +[[providers.layers]] +name = "other_areas_12-14" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type +FROM + osm_other_areas +WHERE + area > 10000 + AND geometry && !BBOX! +""" + +[[providers.layers]] +name = "other_areas_15-20" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_other_areas +WHERE + geometry && !BBOX! +""" \ No newline at end of file diff --git a/images/tiler-server/config/providers/other_areas.zoom.toml b/images/tiler-server/config/providers/other_areas.zoom.toml new file mode 100644 index 00000000..eb279446 --- /dev/null +++ b/images/tiler-server/config/providers/other_areas.zoom.toml @@ -0,0 +1,24 @@ +# Other Areas +[[maps.layers]] +name = "other_areas" +provider_layer = "osm.other_areas_6-8" +min_zoom = 6 +max_zoom = 8 + +[[maps.layers]] +name = "other_areas" +provider_layer = "osm.other_areas_9-11" +min_zoom = 9 +max_zoom = 11 + +[[maps.layers]] +name = "other_areas" +provider_layer = "osm.other_areas_12-14" +min_zoom = 12 +max_zoom = 14 + +[[maps.layers]] +name = "other_areas" +provider_layer = "osm.other_areas_15-20" +min_zoom = 15 +max_zoom = 20 diff --git a/images/tiler-server/config/providers/other_lines.toml b/images/tiler-server/config/providers/other_lines.toml new file mode 100644 index 00000000..358483c7 --- /dev/null +++ b/images/tiler-server/config/providers/other_lines.toml @@ -0,0 +1,24 @@ +# Layer configuration for other lines +[[providers.layers]] +name = "other_lines" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_other_lines +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/other_points.toml b/images/tiler-server/config/providers/other_points.toml new file mode 100644 index 00000000..636a2729 --- /dev/null +++ b/images/tiler-server/config/providers/other_points.toml @@ -0,0 +1,26 @@ +# Layer configuration for other points +[[providers.layers]] +name = "other_points" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'artwork_type' AS artwork_type, + tags->'site_type' AS site_type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_other_points +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/place_areas.toml b/images/tiler-server/config/providers/place_areas.toml new file mode 100644 index 00000000..2f04ef6f --- /dev/null +++ b/images/tiler-server/config/providers/place_areas.toml @@ -0,0 +1,23 @@ +# Layer configuration for place areas +[[providers.layers]] +name = "place_areas" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_place_areas +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/place_points.toml b/images/tiler-server/config/providers/place_points.toml new file mode 100644 index 00000000..9f6dd7c1 --- /dev/null +++ b/images/tiler-server/config/providers/place_points.toml @@ -0,0 +1,24 @@ +# Layer configuration for place points +[[providers.layers]] +name = "place_points" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + tags->'capital' AS capital, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_place_points +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/transport_areas.toml b/images/tiler-server/config/providers/transport_areas.toml new file mode 100644 index 00000000..f3d9a95b --- /dev/null +++ b/images/tiler-server/config/providers/transport_areas.toml @@ -0,0 +1,24 @@ +[[providers.layers]] +name = "transport_areas" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_transport_areas +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/transport_associated_streets.toml b/images/tiler-server/config/providers/transport_associated_streets.toml new file mode 100644 index 00000000..690b8ff4 --- /dev/null +++ b/images/tiler-server/config/providers/transport_associated_streets.toml @@ -0,0 +1,29 @@ +# Layer configuration for transport associated streets +[[providers.layers]] +name = "transport_associated_streets" +geometry_fieldname = "geometry" +geometry_type = "LineString" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + r.id, + m.member, + r.osm_id, + m.name, + m.relname, + m.index, + r.type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_relations r, + osm_relation_members m +WHERE + r.osm_id = m.osm_id + AND r.type = 'associatedStreet' + AND geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/transport_lines.toml b/images/tiler-server/config/providers/transport_lines.toml new file mode 100644 index 00000000..c6d085f7 --- /dev/null +++ b/images/tiler-server/config/providers/transport_lines.toml @@ -0,0 +1,165 @@ +# Layer configuration for transport lines gen0 +[[providers.layers]] +name = "transport_lines_gen0" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + type, + tunnel, + bridge, + ref, + service, + tags->'electrified' AS electrified, + tags->'highspeed' AS highspeed, + tags->'usage' AS usage +FROM + osm_transport_lines_gen0 +WHERE + type IN ('motorway', 'trunk', 'motorway_link', 'trunk_link', 'primary') + AND tunnel = 0 + AND bridge = 0 + AND geometry && !BBOX! +""" + +# Layer configuration for transport lines gen1 +[[providers.layers]] +name = "transport_lines_gen1" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + ref, + class, + type, + service, + tags->'electrified' AS electrified, + tags->'highspeed' AS highspeed, + tags->'usage' AS usage +FROM + osm_transport_lines_gen1 +WHERE + type IN ( + 'motorway', 'trunk', 'primary', 'primary_link', 'secondary', + 'motorway_link', 'trunk_link', 'rail', 'subway', 'light_rail', + 'tram', 'narrow_gauge', 'monorail', 'preserved', 'miniature', + 'funicular', 'taxiway', 'runway', 'proposed', 'construction', + 'disused', 'abandoned', 'razed', 'ferry' + ) + AND geometry && !BBOX! +""" + +# Layer configuration for transport lines 11-12 +[[providers.layers]] +name = "transport_lines_11-12" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + osm_id, + name, + ref, + class, + type, + tunnel, + bridge, + access, + service, + ford, + tags->'construction' AS construction, + tags->'electrified' AS electrified, + tags->'highspeed' AS highspeed, + tags->'usage' AS usage +FROM + osm_transport_lines +WHERE + type IN ( + 'motorway', 'motorway_link', 'trunk', 'trunk_link', + 'primary', 'primary_link', 'secondary', 'secondary_link', + 'tertiary', 'tertiary_link', 'rail', 'subway', 'light_rail', + 'tram', 'narrow_gauge', 'monorail', 'preserved', 'miniature', + 'funicular', 'taxiway', 'runway', 'proposed', 'construction', + 'disused', 'abandoned', 'razed', 'apron', 'ferry' + ) + AND geometry && !BBOX! +""" + +# Layer configuration for transport lines 13 +[[providers.layers]] +name = "transport_lines_13" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + ref, + class, + type, + tunnel, + bridge, + access, + service, + ford, + tags->'construction' AS construction, + tags->'electrified' AS electrified, + tags->'highspeed' AS highspeed, + tags->'usage' AS usage +FROM + osm_transport_lines +WHERE + type IN ( + 'motorway', 'motorway_link', 'trunk', 'trunk_link', + 'primary', 'primary_link', 'secondary', 'secondary_link', + 'tertiary', 'tertiary_link', 'rail', 'subway', 'light_rail', + 'tram', 'narrow_gauge', 'monorail', 'preserved', + 'miniature', 'funicular', 'taxiway', 'runway', 'residential', + 'taxiway', 'runway', 'proposed', 'construction', 'disused', + 'abandoned', 'razed', 'apron', 'ferry' + ) + AND geometry && !BBOX! +""" + +# Layer configuration for transport lines 14-20 +[[providers.layers]] +name = "transport_lines_14-20" +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + ref, + class, + type, + tunnel, + bridge, + access, + service, + ford, + tags->'construction' AS construction, + tags->'usage' AS usage, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_transport_lines +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/transport_lines.zoom.toml b/images/tiler-server/config/providers/transport_lines.zoom.toml new file mode 100644 index 00000000..96a4d703 --- /dev/null +++ b/images/tiler-server/config/providers/transport_lines.zoom.toml @@ -0,0 +1,29 @@ +[[maps.layers]] +name = "transport_lines" +provider_layer = "osm.transport_lines_gen0" +min_zoom = 3 +max_zoom = 5 + +[[maps.layers]] +name = "transport_lines" +provider_layer = "osm.transport_lines_gen1" +min_zoom = 6 +max_zoom = 10 + +[[maps.layers]] +name = "transport_lines" +provider_layer = "osm.transport_lines_11-12" +min_zoom = 11 +max_zoom = 12 + +[[maps.layers]] +name = "transport_lines" +provider_layer = "osm.transport_lines_13" +min_zoom = 13 +max_zoom = 13 + +[[maps.layers]] +name = "transport_lines" +provider_layer = "osm.transport_lines_14-20" +min_zoom = 14 +max_zoom = 20 \ No newline at end of file diff --git a/images/tiler-server/config/providers/transport_points.toml b/images/tiler-server/config/providers/transport_points.toml new file mode 100644 index 00000000..d69ea2e1 --- /dev/null +++ b/images/tiler-server/config/providers/transport_points.toml @@ -0,0 +1,24 @@ +# Layer configuration for transport points +[[providers.layers]] +name = "transport_points" +geometry_fieldname = "geometry" +geometry_type = "point" +id_fieldname = "id" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + class, + type, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_transport_points +WHERE + geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/water_areas.toml b/images/tiler-server/config/providers/water_areas.toml new file mode 100644 index 00000000..8cd3aafc --- /dev/null +++ b/images/tiler-server/config/providers/water_areas.toml @@ -0,0 +1,175 @@ +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +name = "water_areas_gen0_0-2" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 10000), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_water_areas_gen0 +WHERE + type IN ('water', 'riverbank') + AND area > 100000000 + AND geometry && !BBOX! +""" + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +name = "water_areas_gen0_3-5" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 1000), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_water_areas_gen0 +WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') + AND area > 50000000 + AND geometry && !BBOX! +""" + +# Water bodies > 1,000,000 sqm +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +name = "water_areas_gen0_6-7" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 500), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_water_areas_gen0 +WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') + AND area > 1000000 + AND geometry && !BBOX! +""" + +# Water bodies > 10,000 sqm +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +name = "water_areas_gen0_8-9" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 100), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_water_areas_gen0 +WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') + AND area > 10000 + AND geometry && !BBOX! +""" + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "osm_id" +name = "water_areas_gen1_10-12" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 50), !BBOX!) AS geometry, + ABS(osm_id) as osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_water_areas_gen1 +WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank') + AND geometry && !BBOX! +""" + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +name = "water_areas_13-15" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 5), !BBOX!) AS geometry, + id, + osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_water_areas +WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank', 'dock') + AND geometry && !BBOX! +""" + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "id" +name = "water_areas_16-20" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + area, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_water_areas +WHERE + type IN ('water', 'pond', 'basin', 'canal', 'mill_pond', 'riverbank', 'dock') + AND geometry && !BBOX! +""" diff --git a/images/tiler-server/config/providers/water_areas.zoom.toml b/images/tiler-server/config/providers/water_areas.zoom.toml new file mode 100644 index 00000000..127ffaae --- /dev/null +++ b/images/tiler-server/config/providers/water_areas.zoom.toml @@ -0,0 +1,41 @@ +[[maps.layers]] +name = "water_areas" +provider_layer = "osm.water_areas_gen0_0-2" +min_zoom = 0 +max_zoom = 2 + +[[maps.layers]] +name = "water_areas" +provider_layer = "osm.water_areas_gen0_3-5" +min_zoom = 3 +max_zoom = 5 + +[[maps.layers]] +name = "water_areas" +provider_layer = "osm.water_areas_gen0_6-7" +min_zoom = 6 +max_zoom = 7 + +[[maps.layers]] +name = "water_areas" +provider_layer = "osm.water_areas_gen0_8-9" +min_zoom = 8 +max_zoom = 9 + +[[maps.layers]] +name = "water_areas" +provider_layer = "osm.water_areas_gen1_10-12" +min_zoom = 10 +max_zoom = 12 + +[[maps.layers]] +name = "water_areas" +provider_layer = "osm.water_areas_13-15" +min_zoom = 13 +max_zoom = 15 + +[[maps.layers]] +name = "water_areas" +provider_layer = "osm.water_areas_16-20" +min_zoom = 16 +max_zoom = 20 \ No newline at end of file diff --git a/images/tiler-server/config/providers/water_areas_ne.toml b/images/tiler-server/config/providers/water_areas_ne.toml new file mode 100644 index 00000000..ca597451 --- /dev/null +++ b/images/tiler-server/config/providers/water_areas_ne.toml @@ -0,0 +1,20 @@ +[[providers.layers]] +name = "ne_water_lakes_0-2" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 1000),!BBOX!) AS geometry, name, ogc_fid FROM ne_50m_lakes WHERE wkb_geometry && !BBOX!" + +[[providers.layers]] +name = "ne_water_lakes_3-5" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 500),!BBOX!) AS geometry, name, ogc_fid FROM ne_50m_lakes WHERE wkb_geometry && !BBOX!" + +[[providers.layers]] +name = "ne_water_lakes_6-8" +geometry_fieldname = "geometry" +geometry_type = "multipolygon" +id_fieldname = "ogc_fid" +sql = "SELECT ST_AsMVTGeom(ST_Simplify(wkb_geometry, 100),!BBOX!) AS geometry, name, ogc_fid FROM ne_10m_lakes WHERE wkb_geometry && !BBOX!" diff --git a/images/tiler-server/config/providers/water_lines.toml b/images/tiler-server/config/providers/water_lines.toml new file mode 100644 index 00000000..2f4e06b8 --- /dev/null +++ b/images/tiler-server/config/providers/water_lines.toml @@ -0,0 +1,126 @@ +# Simplification for geometries + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +name = "water_lines_gen0_6-6" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 1500), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge +FROM + osm_water_lines_gen0 +WHERE + type IN ('river', 'canal') + AND geometry && !BBOX! +""" + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +name = "water_lines_gen0_7-7" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 1000), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge +FROM + osm_water_lines_gen0 +WHERE + type IN ('river', 'canal') + AND geometry && !BBOX! +""" + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +name = "water_lines_gen0_8-8" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 500), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge +FROM + osm_water_lines_gen0 +WHERE + type IN ('river', 'canal') + AND geometry && !BBOX! +""" + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +name = "water_lines_gen0_9-9" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 100), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge +FROM + osm_water_lines_gen0 +WHERE + type IN ('river', 'canal') + AND geometry && !BBOX! +""" + + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "osm_id" +name = "water_lines_gen1_10-11" +sql = """ +SELECT + ST_AsMVTGeom(ST_Simplify(geometry, 20), !BBOX!) AS geometry, + ABS(osm_id) AS osm_id, + name, + type, + tags->'bridge' AS bridge, + tags->'surface' AS surface +FROM + osm_water_lines_gen1 +WHERE + type IN ('river', 'canal', 'stream', 'ditch', 'drain', 'dam', 'cliff') + AND geometry && !BBOX! +""" + +[[providers.layers]] +geometry_fieldname = "geometry" +geometry_type = "linestring" +id_fieldname = "id" +name = "water_lines" +sql = """ +SELECT + ST_AsMVTGeom(geometry, !BBOX!) AS geometry, + id, + osm_id, + name, + type, + tags->'bridge' AS bridge, + tags->'surface' AS surface, + tags->'start_date' AS start_date, + tags->'end_date' AS end_date, + tags->'name:ar' as name_ar, + tags->'name:en' as name_en, + tags->'name:he' as name_he, + tags->'name:fr' as name_fr, + tags->'name:hy' as name_hy +FROM + osm_water_lines +WHERE + type IN ('river', 'canal', 'stream', 'ditch', 'drain', 'dam', 'cliff') + AND geometry && !BBOX! +""" \ No newline at end of file diff --git a/images/tiler-server/config/providers/water_lines.zoom.toml b/images/tiler-server/config/providers/water_lines.zoom.toml new file mode 100644 index 00000000..ce286227 --- /dev/null +++ b/images/tiler-server/config/providers/water_lines.zoom.toml @@ -0,0 +1,35 @@ +[[maps.layers]] +name = "water_lines" +provider_layer = "osm.water_lines_gen0_6-6" +min_zoom = 6 +max_zoom = 6 + +[[maps.layers]] +name = "water_lines" +provider_layer = "osm.water_lines_gen0_7-7" +min_zoom = 7 +max_zoom = 7 + +[[maps.layers]] +name = "water_lines" +provider_layer = "osm.water_lines_gen0_8-8" +min_zoom = 8 +max_zoom = 8 + +[[maps.layers]] +name = "water_lines" +provider_layer = "osm.water_lines_gen0_9-9" +min_zoom = 9 +max_zoom = 9 + +[[maps.layers]] +name = "water_lines" +provider_layer = "osm.water_lines_gen1_10-11" +min_zoom = 10 +max_zoom = 11 + +[[maps.layers]] +name = "water_lines" +provider_layer = "osm.water_lines" +min_zoom = 12 +max_zoom = 20 \ No newline at end of file diff --git a/images/tiler-server/start.sh b/images/tiler-server/start.sh index d7ea9bd5..2ff78049 100755 --- a/images/tiler-server/start.sh +++ b/images/tiler-server/start.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash flag=true +mkdir -p $TILER_CACHE_BASEPATH while "$flag" = true; do pg_isready -h $POSTGRES_HOST -p 5432 >/dev/null 2>&2 || continue flag=false