Merge remote-tracking branch 'github/master' into merge-gh-2025
# Conflicts: # layers/boundary/mapping.yaml # layers/mountain_peak/style.json # layers/place/style.json # layers/poi/poi.yaml
12
.env
@ -4,7 +4,7 @@
|
||||
TILESET_FILE=openmaptiles.yaml
|
||||
|
||||
# Use 3-part patch version to ignore patch updates, e.g. 7.0.0
|
||||
TOOLS_VERSION=7.0
|
||||
TOOLS_VERSION=7.1
|
||||
|
||||
# Make sure these values are in sync with the ones in .env-postgres file
|
||||
PGDATABASE=openmaptiles
|
||||
@ -31,21 +31,13 @@ MAX_ZOOM=16
|
||||
# Use true (case sensitive) to allow data updates
|
||||
DIFF_MODE=false
|
||||
|
||||
# Some area data like openstreetmap.fr can contain invalid references
|
||||
# that must be cleaned up before using it for borders -- set it to true.
|
||||
BORDERS_CLEANUP=false
|
||||
|
||||
# The current setup assumes this file is placed inside the data/ dir
|
||||
MBTILES_FILE=tiles.mbtiles
|
||||
|
||||
# This is the current repl_config.json location, pre-configured in the tools Dockerfile
|
||||
# Makefile and quickstart replace it with the dynamically generated one, but we keep it here in case some other method is used to run.
|
||||
IMPOSM_CONFIG_FILE=/usr/src/app/config/repl_config.json
|
||||
|
||||
# import-borders temp files - set them here to defaults, and override in the Makefile based on the area
|
||||
BORDERS_CLEANUP_FILE=data/borders/cleanup.pbf
|
||||
BORDERS_PBF_FILE=data/borders/filtered.pbf
|
||||
BORDERS_CSV_FILE=data/borders/lines.csv
|
||||
|
||||
# Number of parallel processes to use when importing sql files
|
||||
MAX_PARALLEL_PSQL=5
|
||||
#MAX_PARALLEL_PSQL=16
|
||||
|
||||
8
.github/workflows/integrity.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
steps:
|
||||
|
||||
- name: Checkout the changes
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run quickstart for a small area
|
||||
env:
|
||||
@ -27,7 +27,7 @@ jobs:
|
||||
./quickstart.sh $area
|
||||
|
||||
- name: Save quickstart.log
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: quickstart.log
|
||||
path: quickstart.log
|
||||
@ -52,13 +52,13 @@ jobs:
|
||||
# Download 2+ month old data
|
||||
export old_date=$(date --date="$(date +%Y-%m-15) -2 month" +'%y%m01')
|
||||
echo Downloading $old_date extract of $area
|
||||
docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "wget -O data/$area.osm.pbf http://download.geofabrik.de/$area-$old_date.osm.pbf"
|
||||
docker compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "wget -O data/$area.osm.pbf http://download.geofabrik.de/$area-$old_date.osm.pbf"
|
||||
# Initial import and tile generation
|
||||
./quickstart.sh $area
|
||||
sleep 2
|
||||
echo Downloading updates
|
||||
# Loop to recover from potential "ERROR 429: Too Many Requests"
|
||||
docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "
|
||||
docker compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "
|
||||
while ! osmupdate --keep-tempfiles --base-url=$(sed -n 's/ *\"replication_url\": //p' data/$area.repl.json) data/$area.osm.pbf data/changes.osc.gz ; do
|
||||
sleep 2;
|
||||
echo Sleeping...;
|
||||
|
||||
24
.github/workflows/performance.yml
vendored
@ -45,7 +45,7 @@ jobs:
|
||||
|
||||
- name: Cache test data download
|
||||
id: cache-testdata
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ci_cache
|
||||
key: "v2-${{ env.TEST_DATA_URL }}"
|
||||
@ -58,7 +58,7 @@ jobs:
|
||||
curl --silent --show-error --location --output ci_cache/perf-test-areas-latest.osm.pbf "$TEST_DATA_URL"
|
||||
|
||||
- name: Get code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Fetch the last two commits in case this is a PR,
|
||||
# and we need to profile the base branch first
|
||||
@ -76,10 +76,10 @@ jobs:
|
||||
# Take the first parent of the grafted commit (cannot use HEAD^1 with shallow clones)
|
||||
REV_HASH=$(git cat-file -p $REV_HASH | awk 'NR > 1 {if(/^parent/){print $2; exit}}')
|
||||
fi
|
||||
echo "::set-output name=hash::$REV_HASH"
|
||||
echo "hash=$REV_HASH" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up caching for the performance results
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: perf_cache
|
||||
# If profiling result cache has incompatible format, increase this "v" number
|
||||
@ -163,8 +163,8 @@ jobs:
|
||||
# Get database total size, in MB
|
||||
# Once Makefile has a few more improvements, we can use this approach instead:
|
||||
# echo $'\\set QUIET on \\a \\x off \\t \\\\ select pg_database_size(current_database())/1024/1024;' | make -s psql
|
||||
DB_SIZE_MB=$(docker-compose run --rm -u $(id -u):$(id -g) openmaptiles-tools psql.sh -qtAc 'select pg_database_size(current_database())/1024/1024;')
|
||||
docker-compose run --rm -u $(id -u):$(id -g) openmaptiles-tools pg_dump --schema-only > "${PROFILE_DIR}/schema.sql"
|
||||
DB_SIZE_MB=$(docker compose run --rm -u $(id -u):$(id -g) openmaptiles-tools psql.sh -qtAc 'select pg_database_size(current_database())/1024/1024;')
|
||||
docker compose run --rm -u $(id -u):$(id -g) openmaptiles-tools pg_dump --schema-only > "${PROFILE_DIR}/schema.sql"
|
||||
echo "$DB_SIZE_MB" > "${PROFILE_DIR}/db_size.tsv"
|
||||
}
|
||||
|
||||
@ -183,14 +183,14 @@ jobs:
|
||||
git reset --hard ${CURRENT_SHA}^1
|
||||
fi
|
||||
|
||||
docker-compose pull
|
||||
docker compose pull
|
||||
PROFILE_DIR=../perf_cache
|
||||
create_db
|
||||
if [ ! -f ../ci_cache/wikidata-cache.json ]; then
|
||||
cp cache/wikidata-cache.json ../ci_cache/wikidata-cache.json
|
||||
fi
|
||||
|
||||
(set -x; profile test-perf docker-compose run --rm -T openmaptiles-tools \
|
||||
(set -x; profile test-perf docker compose run --rm -T openmaptiles-tools \
|
||||
test-perf openmaptiles.yaml $TEST_PERF_PARAMS \
|
||||
--record /tileset/results.json)
|
||||
echo "Done generating base perf results, moving them to ../perf_cache"
|
||||
@ -205,7 +205,7 @@ jobs:
|
||||
echo "Found cached performance results"
|
||||
fi
|
||||
|
||||
docker-compose pull
|
||||
docker compose pull
|
||||
pushd ../perf_cache
|
||||
echo "Should be in perf_cache"
|
||||
pwd
|
||||
@ -231,7 +231,7 @@ jobs:
|
||||
echo "Copying existing perf_cache results to current dir"
|
||||
pwd
|
||||
cp ../perf_cache/results.json .
|
||||
OUTPUT="$(set -x; profile test-perf docker-compose run --rm -T openmaptiles-tools \
|
||||
OUTPUT="$(set -x; profile test-perf docker compose run --rm -T openmaptiles-tools \
|
||||
test-perf openmaptiles.yaml $TEST_PERF_PARAMS \
|
||||
--compare /tileset/results.json --record /tileset/pr-results.json)"
|
||||
rm results.json
|
||||
@ -287,14 +287,14 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Save performance artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: performance_results
|
||||
path: artifacts
|
||||
|
||||
- name: Save PR message artifact
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: pr_message
|
||||
path: pr_message
|
||||
|
||||
2
.github/workflows/sql-tests.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
steps:
|
||||
|
||||
- name: Checkout the changes
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2023, MapTiler.com & OpenMapTiles contributors.
|
||||
Copyright (c) 2024, MapTiler.com & OpenMapTiles contributors.
|
||||
All rights reserved.
|
||||
|
||||
The vector tile schema has been developed by Klokan Technologies GmbH and
|
||||
|
||||
12
Makefile
@ -293,20 +293,20 @@ ifeq (,$(wildcard build/sql/run_last.sql))
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c \
|
||||
'generate-sql $(TILESET_FILE) --dir ./build/sql \
|
||||
&& generate-sqltomvt $(TILESET_FILE) \
|
||||
--key --gzip --postgis-ver 3.0.1 \
|
||||
--key --gzip --postgis-ver 3.3.4 \
|
||||
--function --fname=getmvt >> ./build/sql/run_last.sql'
|
||||
endif
|
||||
|
||||
.PHONY: build-sprite
|
||||
build-sprite: init-dirs
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c 'spritezero build/style/sprite /style/icons && \
|
||||
spritezero --retina build/style/sprite@2x /style/icons'
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c 'spreet /style/icons build/style/sprite && \
|
||||
spreet --retina /style/icons build/style/sprite@2x'
|
||||
|
||||
.PHONY: build-style
|
||||
build-style: init-dirs
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c 'style-tools recompose $(TILESET_FILE) $(STYLE_FILE) \
|
||||
$(STYLE_HEADER_FILE) && \
|
||||
spritezero build/style/sprite /style/icons && spritezero --retina build/style/sprite@2x /style/icons'
|
||||
spreet /style/icons build/style/sprite && spreet --retina /style/icons build/style/sprite@2x'
|
||||
|
||||
.PHONY: download-fonts
|
||||
download-fonts:
|
||||
@ -509,7 +509,7 @@ start-tileserver: init-dirs build-style download-fonts
|
||||
@echo "* "
|
||||
@echo "***********************************************************"
|
||||
@echo " "
|
||||
docker pull maptiler/tileserver-gl
|
||||
$(DOCKER_COMPOSE_COMMAND) pull tileserver-gl
|
||||
@echo " "
|
||||
@echo "***********************************************************"
|
||||
@echo "* "
|
||||
@ -606,7 +606,7 @@ psql-list-tables: init-dirs
|
||||
.PHONY: vacuum-db
|
||||
vacuum-db: init-dirs
|
||||
@echo "Start - postgresql: VACUUM ANALYZE VERBOSE;"
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools psql.sh -v ON_ERROR_STOP=1 -P pager=off -c 'VACUUM ANALYZE VERBOSE;'
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools psql.sh -v ON_ERROR_STOP=1 -P pager=off -c 'VACUUM (ANALYZE, VERBOSE);'
|
||||
|
||||
.PHONY: analyze-db
|
||||
analyze-db: init-dirs
|
||||
|
||||
13
README.md
@ -11,7 +11,8 @@ Please keep in mind that OpenMapTiles schema should display general topographic
|
||||
- :link: Data for download: https://www.maptiler.com/data/
|
||||
- :link: Hosting https://www.maptiler.com/cloud/
|
||||
- :link: Create own layer https://github.com/openmaptiles/openmaptiles-skiing
|
||||
- :link: Discuss at the #openmaptiles channel at [OSM Slack](https://osmus-slack.herokuapp.com/)
|
||||
- :link: Practical usage of OpenMapTiles https://github.com/maptiler/foss4g-workshop
|
||||
- :link: Discuss at the #openmaptiles channel at [OSM Slack](https://slack.openstreetmap.us/)
|
||||
|
||||
## Styles
|
||||
|
||||
@ -102,7 +103,7 @@ Now start up the database container.
|
||||
make start-db
|
||||
```
|
||||
|
||||
Import external data from [OpenStreetMapData](http://osmdata.openstreetmap.de/), [Natural Earth](http://www.naturalearthdata.com/) and [OpenStreetMap Lake Labels](https://github.com/lukasmartinelli/osm-lakelines). Natural Earth country boundaries are used in the few lowest zoom levels.
|
||||
Import external data from [OpenStreetMapData](http://osmdata.openstreetmap.de/), [Natural Earth](http://www.naturalearthdata.com/) and [OpenStreetMap Lake Labels](https://github.com/openmaptiles/osm-lakelines). Natural Earth country boundaries are used in the few lowest zoom levels.
|
||||
|
||||
```bash
|
||||
make import-data
|
||||
@ -159,7 +160,7 @@ make build-style
|
||||
Now you are ready to **generate the vector tiles**. By default, `./.env` specifies the entire planet BBOX for zooms 0-7, but running `generate-bbox-file` will analyze the data file and set the `BBOX` param to limit tile generation.
|
||||
|
||||
```
|
||||
make generate-bbox-file # compute data bbox -- not needed for the whole planet
|
||||
make generate-bbox-file # compute data bbox -- not needed for the whole planet or for downloaded area by `make download`
|
||||
make generate-tiles-pg # generate tiles
|
||||
```
|
||||
|
||||
@ -174,17 +175,19 @@ make download area=albania # download albania .osm.pbf file -- can be skipped i
|
||||
make import-osm # import data into postgres
|
||||
make import-wikidata # import Wikidata
|
||||
make import-sql # create / import sql functions
|
||||
make generate-bbox-file # compute data bbox -- not needed for the whole planet
|
||||
make generate-bbox-file # compute data bbox -- not needed for the whole planet or for downloaded area by `make download`
|
||||
make generate-tiles-pg # generate tiles
|
||||
```
|
||||
Instead of calling `make download area=albania` you can add a .osm.pbf file in the `data` folder `openmaptiles/data/your_area_file.osm.pbf`
|
||||
|
||||
To change the name of the output filename, you can modify the variable `MBTILES_FILE` in the `.env` file or set up the environment variable `MBTILES_FILE` before running `./quickstart.sh` or `make generate-tiles-pg` (e.g., `MBTILES_FILENAME=monaco.mbtiles ./quickstart.sh monaco`).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
All code in this repository is under the [BSD license](./LICENSE.md). Design and the cartography decisions encoded in the schema and SQL are licensed under [CC-BY](./LICENSE.md).
|
||||
|
||||
Products or services using maps derived from OpenMapTiles schema need to visibly credit "OpenMapTiles.org" or reference "OpenMapTiles" with a link to https://openmaptiles.org/. Exceptions to attribution requirement can be granted on request.
|
||||
Products or services using maps derived from OpenMapTiles schema need to **visibly credit "OpenMapTiles.org"** or **reference "OpenMapTiles"** with a link to https://openmaptiles.org/. Exceptions to attribution requirement can be granted on request.
|
||||
|
||||
For a browsable electronic map based on OpenMapTiles and OpenStreetMap data, the
|
||||
credit should appear in the corner of the map. For example:
|
||||
|
||||
@ -5,9 +5,9 @@ layer:
|
||||
buffer_size: 64
|
||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the aerodrome.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the aerodrome. Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
class:
|
||||
description: |
|
||||
Distinguish between more and less important aerodromes.
|
||||
|
||||
@ -93,12 +93,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_aerodrome_label_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE aerodrome_label.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_aerodrome_label_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE aerodrome_label.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -150,38 +150,10 @@ CREATE MATERIALIZED VIEW osm_border_linestring_gen_z4 AS
|
||||
(
|
||||
SELECT ST_Simplify(geometry, ZRes(5)) AS geometry, adm0_l, adm0_r, admin_level, disputed, name, claimed_by, maritime
|
||||
FROM osm_border_linestring_gen_z5
|
||||
WHERE admin_level = 2 AND (maritime OR disputed)
|
||||
WHERE admin_level = 2 AND maritime
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen_z4_idx ON osm_border_linestring_gen_z4 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_border_linestring_gen_z4 -> osm_border_disp_linestring_gen_z3
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_disp_linestring_gen_z3 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_disp_linestring_gen_z3 AS
|
||||
(
|
||||
SELECT ST_Simplify(geometry, ZRes(4)) AS geometry, adm0_l, adm0_r, admin_level, TRUE AS disputed, name, claimed_by, maritime
|
||||
FROM osm_border_linestring_gen_z4
|
||||
WHERE disputed -- AND admin_level = 2
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_disp_linestring_gen_z3_idx ON osm_border_disp_linestring_gen_z3 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_border_disp_linestring_gen_z3 -> osm_border_disp_linestring_gen_z2
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_disp_linestring_gen_z2 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_disp_linestring_gen_z2 AS
|
||||
(
|
||||
SELECT ST_Simplify(geometry, ZRes(3)) AS geometry, adm0_l, adm0_r, admin_level, TRUE AS disputed, name, claimed_by, maritime
|
||||
FROM osm_border_disp_linestring_gen_z3
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_disp_linestring_gen_z2_idx ON osm_border_disp_linestring_gen_z2 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_border_disp_linestring_gen_z2 -> osm_border_disp_linestring_gen_z1
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_disp_linestring_gen_z1 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_disp_linestring_gen_z1 AS
|
||||
(
|
||||
SELECT ST_Simplify(geometry, ZRes(2)) AS geometry, adm0_l, adm0_r, admin_level, TRUE AS disputed, name, claimed_by, maritime
|
||||
FROM osm_border_disp_linestring_gen_z2
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_disp_linestring_gen_z1_idx ON osm_border_disp_linestring_gen_z1 USING gist (geometry);
|
||||
|
||||
-- ne_10m_admin_0_boundary_lines_land
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land -> ne_10m_admin_0_boundary_lines_land_gen_z4
|
||||
DROP MATERIALIZED VIEW IF EXISTS ne_10m_admin_0_boundary_lines_land_gen_z4 CASCADE;
|
||||
@ -190,7 +162,7 @@ CREATE MATERIALIZED VIEW ne_10m_admin_0_boundary_lines_land_gen_z4 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(6)) as geometry,
|
||||
2 AS admin_level,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN 'ne10m_' || ogc_fid ELSE NULL::text END) AS disputed_name,
|
||||
NULL::text AS disputed_name,
|
||||
NULL::text AS claimed_by,
|
||||
FALSE AS maritime
|
||||
FROM ne_10m_admin_0_boundary_lines_land
|
||||
@ -198,6 +170,21 @@ WHERE featurecla <> 'Lease limit'
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_land_gen_z4_idx ON ne_10m_admin_0_boundary_lines_land_gen_z4 USING gist (geometry);
|
||||
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land -> ne_10m_admin_0_boundary_lines_land_disputed
|
||||
DROP MATERIALIZED VIEW IF EXISTS ne_10m_admin_0_boundary_lines_land_disputed CASCADE;
|
||||
CREATE MATERIALIZED VIEW ne_10m_admin_0_boundary_lines_land_disputed AS
|
||||
(
|
||||
SELECT geometry,
|
||||
2 AS admin_level,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
|
||||
NULL::text AS disputed_name,
|
||||
NULL::text AS claimed_by,
|
||||
FALSE AS maritime
|
||||
FROM ne_10m_admin_0_boundary_lines_land
|
||||
WHERE featurecla LIKE 'Disputed%' AND adm0_left = 'South Sudan' AND adm0_right = 'Kenya'
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_land_disputed_idx ON ne_10m_admin_0_boundary_lines_land_disputed USING gist (geometry);
|
||||
|
||||
-- ne_10m_admin_1_states_provinces_lines
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines -> ne_10m_admin_1_states_provinces_lines_gen_z4
|
||||
DROP MATERIALIZED VIEW IF EXISTS ne_10m_admin_1_states_provinces_lines_gen_z4 CASCADE;
|
||||
@ -267,7 +254,7 @@ CREATE MATERIALIZED VIEW ne_50m_admin_0_boundary_lines_land_gen_z3 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(5)) as geometry,
|
||||
2 AS admin_level,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN 'ne50m_' || ogc_fid ELSE NULL::text END) AS disputed_name,
|
||||
NULL::text AS disputed_name,
|
||||
NULL::text AS claimed_by,
|
||||
FALSE AS maritime
|
||||
FROM ne_50m_admin_0_boundary_lines_land
|
||||
@ -310,7 +297,7 @@ CREATE MATERIALIZED VIEW ne_110m_admin_0_boundary_lines_land_gen_z0 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(2)) as geometry,
|
||||
2 AS admin_level,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN 'ne110m_' || ogc_fid ELSE NULL::text END) AS disputed_name,
|
||||
NULL::text AS disputed_name,
|
||||
NULL::text AS claimed_by,
|
||||
FALSE AS maritime
|
||||
FROM ne_110m_admin_0_boundary_lines_land
|
||||
@ -347,8 +334,10 @@ FROM ne_110m_admin_0_boundary_lines_land_gen_z0
|
||||
|
||||
-- etldoc: ne_50m_admin_0_boundary_lines_land_gen_z1 -> boundary_z1
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z1 -> boundary_z1
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land_disputed -> boundary_z1
|
||||
-- etldoc: osm_border_disp_linestring_gen_z1 -> boundary_z1
|
||||
CREATE OR REPLACE VIEW boundary_z1 AS
|
||||
DROP MATERIALIZED VIEW IF EXISTS boundary_z1 CASCADE;
|
||||
CREATE MATERIALIZED VIEW boundary_z1 AS
|
||||
(
|
||||
SELECT geometry,
|
||||
admin_level,
|
||||
@ -374,18 +363,21 @@ SELECT geometry,
|
||||
admin_level,
|
||||
NULL::text AS adm0_l,
|
||||
NULL::text AS adm0_r,
|
||||
TRUE AS disputed,
|
||||
edit_name(name) AS disputed_name,
|
||||
disputed,
|
||||
disputed_name,
|
||||
claimed_by,
|
||||
maritime
|
||||
FROM osm_border_disp_linestring_gen_z1
|
||||
FROM ne_10m_admin_0_boundary_lines_land_disputed
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS boundary_z1_idx ON boundary_z1 USING gist (geometry);
|
||||
|
||||
|
||||
-- etldoc: ne_50m_admin_0_boundary_lines_land_gen_z2 -> boundary_z2
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z2 -> boundary_z2
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land_disputed -> boundary_z2
|
||||
-- etldoc: osm_border_disp_linestring_gen_z2 -> boundary_z2
|
||||
CREATE OR REPLACE VIEW boundary_z2 AS
|
||||
DROP MATERIALIZED VIEW IF EXISTS boundary_z2 CASCADE;
|
||||
CREATE MATERIALIZED VIEW boundary_z2 AS
|
||||
(
|
||||
SELECT geometry,
|
||||
admin_level,
|
||||
@ -411,17 +403,20 @@ SELECT geometry,
|
||||
admin_level,
|
||||
NULL::text AS adm0_l,
|
||||
NULL::text AS adm0_r,
|
||||
TRUE AS disputed,
|
||||
edit_name(name) AS disputed_name,
|
||||
disputed,
|
||||
disputed_name,
|
||||
claimed_by,
|
||||
maritime
|
||||
FROM osm_border_disp_linestring_gen_z2
|
||||
FROM ne_10m_admin_0_boundary_lines_land_disputed
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS boundary_z2_idx ON boundary_z2 USING gist (geometry);
|
||||
|
||||
-- etldoc: ne_50m_admin_0_boundary_lines_land_gen_z3 -> boundary_z3
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z3 -> boundary_z3
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land_disputed -> boundary_z3
|
||||
-- etldoc: osm_border_disp_linestring_gen_z3 -> boundary_z3
|
||||
CREATE OR REPLACE VIEW boundary_z3 AS
|
||||
DROP MATERIALIZED VIEW IF EXISTS boundary_z3 CASCADE;
|
||||
CREATE MATERIALIZED VIEW boundary_z3 AS
|
||||
(
|
||||
SELECT geometry,
|
||||
admin_level,
|
||||
@ -447,17 +442,19 @@ SELECT geometry,
|
||||
admin_level,
|
||||
NULL::text AS adm0_l,
|
||||
NULL::text AS adm0_r,
|
||||
TRUE AS disputed,
|
||||
edit_name(name) AS disputed_name,
|
||||
disputed,
|
||||
disputed_name,
|
||||
claimed_by,
|
||||
maritime
|
||||
FROM osm_border_disp_linestring_gen_z3
|
||||
FROM ne_10m_admin_0_boundary_lines_land_disputed
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS boundary_z3_idx ON boundary_z3 USING gist (geometry);
|
||||
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land_gen_z4 -> boundary_z4
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z4 -> boundary_z4
|
||||
-- etldoc: osm_border_linestring_gen_z4 -> boundary_z4
|
||||
CREATE OR REPLACE VIEW boundary_z4 AS
|
||||
DROP MATERIALIZED VIEW IF EXISTS boundary_z4 CASCADE;
|
||||
CREATE MATERIALIZED VIEW boundary_z4 AS
|
||||
(
|
||||
SELECT geometry,
|
||||
admin_level,
|
||||
@ -489,6 +486,7 @@ SELECT geometry,
|
||||
maritime
|
||||
FROM osm_border_linestring_gen_z4
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS boundary_z4_idx ON boundary_z4 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_border_linestring_gen_z5 -> boundary_z5
|
||||
CREATE OR REPLACE VIEW boundary_z5 AS
|
||||
@ -624,7 +622,7 @@ FROM osm_border_linestring_gen_z13
|
||||
);
|
||||
|
||||
-- etldoc: layer_boundary[shape=record fillcolor=lightpink, style="rounded,filled",
|
||||
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1> z1 |<z2> z2 | <z3> z3 | <z4> z4 | <z5> z5 | <z6> z6 | <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13+"]
|
||||
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1> z1 |<z2> z2 | <z3> z3 | <z4> z4 | <z5> z5 | <z6> z6 | <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14> z14+"]
|
||||
CREATE OR REPLACE FUNCTION layer_boundary(bbox geometry, zoom_level int)
|
||||
RETURNS TABLE
|
||||
(
|
||||
@ -635,11 +633,14 @@ CREATE OR REPLACE FUNCTION layer_boundary(bbox geometry, zoom_level int)
|
||||
disputed int,
|
||||
disputed_name text,
|
||||
claimed_by text,
|
||||
maritime int
|
||||
maritime int,
|
||||
class text,
|
||||
name text,
|
||||
tags hstore
|
||||
)
|
||||
AS
|
||||
$$
|
||||
SELECT geometry, admin_level, adm0_l, adm0_r, disputed::int, disputed_name, claimed_by, maritime::int
|
||||
SELECT geometry, admin_level, adm0_l, adm0_r, disputed::int, disputed_name, claimed_by, maritime::int, NULL::text, NULL::text, NULL::hstore
|
||||
FROM (
|
||||
-- etldoc: boundary_z0 -> layer_boundary:z0
|
||||
SELECT *
|
||||
@ -724,7 +725,134 @@ FROM (
|
||||
FROM boundary_z13
|
||||
WHERE geometry && bbox
|
||||
AND zoom_level >= 13
|
||||
) AS zoom_levels;
|
||||
) AS segment_zoom_levels
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT geometry, NULL::int, NULL::text, NULL::text, NULL::int, NULL::text, NULL::text, NULL::int, class, name, tags
|
||||
FROM (
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z4 -> layer_boundary:z4
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z4
|
||||
WHERE zoom_level = 4
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z5 -> layer_boundary:z5
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z5
|
||||
WHERE zoom_level = 5
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z6 -> layer_boundary:z6
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z6
|
||||
WHERE zoom_level = 6
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z7 -> layer_boundary:z7
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z7
|
||||
WHERE zoom_level = 7
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z8 -> layer_boundary:z8
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z8
|
||||
WHERE zoom_level = 8
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z9 -> layer_boundary:z9
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z9
|
||||
WHERE zoom_level = 9
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z10 -> layer_boundary:z10
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z10
|
||||
WHERE zoom_level = 10
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z11 -> layer_boundary:z11
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z11
|
||||
WHERE zoom_level = 11
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z12 -> layer_boundary:z12
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z12
|
||||
WHERE zoom_level = 12
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z13 -> layer_boundary:z13
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z13
|
||||
WHERE zoom_level = 13
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon -> layer_boundary:z14
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon
|
||||
WHERE zoom_level = 14
|
||||
AND geometry && bbox
|
||||
|
||||
) AS area_zoom_levels
|
||||
|
||||
$$ LANGUAGE SQL STABLE
|
||||
-- STRICT
|
||||
PARALLEL SAFE;
|
||||
|
||||
@ -9,13 +9,17 @@ layer:
|
||||
- ne_50m_admin_0_boundary_lines_land
|
||||
- ne_110m_admin_0_boundary_lines_land
|
||||
description: |
|
||||
Contains administrative boundaries as linestrings.
|
||||
Contains administrative boundaries as linestrings and aboriginal lands as polygons.
|
||||
Until z4 [Natural Earth data](http://www.naturalearthdata.com/downloads/) is used after which
|
||||
OSM boundaries ([`boundary=administrative`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative))
|
||||
are present from z5 to z14 (also for maritime boundaries with `admin_level <= 2` at z4).
|
||||
OSM data contains several [`admin_level`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level)
|
||||
but for most styles it makes sense to just style `admin_level=2` and `admin_level=4`.
|
||||
fields:
|
||||
class:
|
||||
description: |
|
||||
Use the **class** to differentiate between different kinds of boundaries. The class for `boundary=aboriginal_lands` is `aboriginal_lands`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value (area features only).
|
||||
admin_level: |
|
||||
OSM [admin_level](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level)
|
||||
indicating the level of importance of this boundary.
|
||||
@ -58,8 +62,9 @@ layer:
|
||||
buffer_size: 4
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
query: (SELECT geometry, admin_level, adm0_l, adm0_r, disputed, disputed_name, claimed_by, maritime FROM layer_boundary(!bbox!, z(!scale_denominator!))) AS t
|
||||
query: (SELECT geometry, admin_level, adm0_l, adm0_r, disputed, disputed_name, claimed_by, maritime, class, name, {name_languages} FROM layer_boundary(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./update_boundary_polygon.sql
|
||||
- ./boundary_name.sql
|
||||
- ./boundary.sql
|
||||
datasources:
|
||||
|
||||
|
Before Width: | Height: | Size: 552 KiB After Width: | Height: | Size: 750 KiB |
@ -4,6 +4,67 @@ generalized_tables:
|
||||
source: border_linestring
|
||||
sql_filter: ST_GeometryType(geometry) = 'ST_LineString' AND (disputed OR dispute OR border_status = 'disputed' OR disputed_by <> '') AND admin_level = 2
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z5 -> osm_boundary_polygon_gen_z4
|
||||
boundary_polygon_gen_z4:
|
||||
source: boundary_polygon_gen_z5
|
||||
sql_filter: area>power(ZRES3,2)
|
||||
tolerance: ZRES4
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z6 -> osm_boundary_polygon_gen_z5
|
||||
boundary_polygon_gen_z5:
|
||||
source: boundary_polygon_gen_z6
|
||||
sql_filter: area>power(ZRES4,2)
|
||||
tolerance: ZRES5
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z7 -> osm_boundary_polygon_gen_z6
|
||||
boundary_polygon_gen_z6:
|
||||
source: boundary_polygon_gen_z7
|
||||
sql_filter: area>power(ZRES5,2)
|
||||
tolerance: ZRES6
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z8 -> osm_boundary_polygon_gen_z7
|
||||
boundary_polygon_gen_z7:
|
||||
source: boundary_polygon_gen_z8
|
||||
sql_filter: area>power(ZRES6,2)
|
||||
tolerance: ZRES7
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z9 -> osm_boundary_polygon_gen_z8
|
||||
boundary_polygon_gen_z8:
|
||||
source: boundary_polygon_gen_z9
|
||||
sql_filter: area>power(ZRES7,2)
|
||||
tolerance: ZRES8
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z10 -> osm_boundary_polygon_gen_z9
|
||||
boundary_polygon_gen_z9:
|
||||
source: boundary_polygon_gen_z10
|
||||
sql_filter: area>power(ZRES8,2)
|
||||
tolerance: ZRES9
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z11 -> osm_boundary_polygon_gen_z10
|
||||
boundary_polygon_gen_z10:
|
||||
source: boundary_polygon_gen_z11
|
||||
sql_filter: area>power(ZRES9,2)
|
||||
tolerance: ZRES10
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z12 -> osm_boundary_polygon_gen_z11
|
||||
boundary_polygon_gen_z11:
|
||||
source: boundary_polygon_gen_z12
|
||||
sql_filter: area>power(ZRES10,2)
|
||||
tolerance: ZRES11
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z13 -> osm_boundary_polygon_gen_z12
|
||||
boundary_polygon_gen_z12:
|
||||
source: boundary_polygon_gen_z13
|
||||
sql_filter: area>power(ZRES11,2)
|
||||
tolerance: ZRES12
|
||||
|
||||
# etldoc: osm_boundary_polygon -> osm_boundary_polygon_gen_z13
|
||||
boundary_polygon_gen_z13:
|
||||
source: boundary_polygon
|
||||
sql_filter: area>power(ZRES12,2) AND ST_IsValid(geometry)
|
||||
tolerance: ZRES13
|
||||
|
||||
|
||||
tables:
|
||||
# etldoc: imposm3 -> osm_border_linestring
|
||||
border_linestring:
|
||||
@ -78,6 +139,32 @@ tables:
|
||||
boundary_type:
|
||||
- maritime
|
||||
|
||||
# etldoc: imposm3 -> osm_boundary_polygon
|
||||
boundary_polygon:
|
||||
type: polygon
|
||||
filters:
|
||||
require:
|
||||
type: [boundary]
|
||||
boundary: [aboriginal_lands]
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
type: validated_geometry
|
||||
- name: name
|
||||
key: name
|
||||
type: string
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- name: boundary
|
||||
key: boundary
|
||||
type: string
|
||||
- name: area
|
||||
type: area
|
||||
mapping:
|
||||
boundary:
|
||||
- aboriginal_lands
|
||||
|
||||
|
||||
# etldoc: imposm3 -> osm_border_disp_relation
|
||||
border_disp_relation:
|
||||
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 22 KiB |
170
layers/boundary/update_boundary_polygon.sql
Normal file
@ -0,0 +1,170 @@
|
||||
ALTER TABLE osm_boundary_polygon
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z13
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z12
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z11
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z10
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z9
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z8
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z7
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z6
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z5
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z13;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z12;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z11;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z10;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z9;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z8;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z7;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z6;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z5;
|
||||
|
||||
-- etldoc: osm_boundary_polygon -> osm_boundary_polygon
|
||||
-- etldoc: osm_boundary_polygon_gen_z13 -> osm_boundary_polygon_gen_z13
|
||||
-- etldoc: osm_boundary_polygon_gen_z12 -> osm_boundary_polygon_gen_z12
|
||||
-- etldoc: osm_boundary_polygon_gen_z11 -> osm_boundary_polygon_gen_z11
|
||||
-- etldoc: osm_boundary_polygon_gen_z10 -> osm_boundary_polygon_gen_z10
|
||||
-- etldoc: osm_boundary_polygon_gen_z9 -> osm_boundary_polygon_gen_z9
|
||||
-- etldoc: osm_boundary_polygon_gen_z8 -> osm_boundary_polygon_gen_z8
|
||||
-- etldoc: osm_boundary_polygon_gen_z7 -> osm_boundary_polygon_gen_z7
|
||||
-- etldoc: osm_boundary_polygon_gen_z6 -> osm_boundary_polygon_gen_z6
|
||||
-- etldoc: osm_boundary_polygon_gen_z5 -> osm_boundary_polygon_gen_z5
|
||||
CREATE OR REPLACE FUNCTION update_osm_boundary_polygon() RETURNS void AS
|
||||
$$
|
||||
BEGIN
|
||||
UPDATE osm_boundary_polygon
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z13
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z12
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z11
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z10
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z9
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z8
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z7
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z6
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z5
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
SELECT update_osm_boundary_polygon();
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_point_geom_idx ON osm_boundary_polygon USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z13_point_geom_idx ON osm_boundary_polygon_gen_z13 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z12_point_geom_idx ON osm_boundary_polygon_gen_z12 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z11_point_geom_idx ON osm_boundary_polygon_gen_z11 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z10_point_geom_idx ON osm_boundary_polygon_gen_z10 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z9_point_geom_idx ON osm_boundary_polygon_gen_z9 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z8_point_geom_idx ON osm_boundary_polygon_gen_z8 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z7_point_geom_idx ON osm_boundary_polygon_gen_z7 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z6_point_geom_idx ON osm_boundary_polygon_gen_z6 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z5_point_geom_idx ON osm_boundary_polygon_gen_z5 USING gist (geometry_point);
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_osm_boundary_polygon_row()
|
||||
RETURNS trigger
|
||||
AS
|
||||
$$
|
||||
BEGIN
|
||||
NEW.tags = update_tags(NEW.tags, NEW.geometry);
|
||||
NEW.geometry_point = ST_PointOnSurface(NEW.geometry);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z13
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z12
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z11
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z10
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z9
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z8
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z7
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z6
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z5
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
@ -14,7 +14,7 @@ SELECT
|
||||
-- etldoc: osm_housenumber_point -> layer_housenumber:z14_
|
||||
osm_id,
|
||||
geometry,
|
||||
housenumber
|
||||
display_housenumber(housenumber)
|
||||
FROM (
|
||||
SELECT
|
||||
osm_id,
|
||||
|
||||
@ -8,11 +8,13 @@ layer:
|
||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
housenumber: Value of the [`addr:housenumber`](http://wiki.openstreetmap.org/wiki/Key:addr) tag.
|
||||
If there are multiple values separated by semi-colons, the first and last value separated by a dash.
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
srid: 900913
|
||||
query: (SELECT geometry, housenumber FROM layer_housenumber(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./housenumber_display.sql
|
||||
- ./housenumber_centroid.sql
|
||||
- ./housenumber.sql
|
||||
datasources:
|
||||
|
||||
@ -86,12 +86,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_housenumber_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE housenumber.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_housenumber_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE housenumber.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
20
layers/housenumber/housenumber_display.sql
Normal file
@ -0,0 +1,20 @@
|
||||
CREATE OR REPLACE FUNCTION display_housenumber_nonnumeric(raw_housenumber text)
|
||||
RETURNS text AS $$
|
||||
-- Find the position of the semicolon in the input string
|
||||
-- and extract the first and last value
|
||||
SELECT substring(raw_housenumber from 1 for position(';' in raw_housenumber) - 1)
|
||||
|| '–'
|
||||
|| substring(raw_housenumber from position(';' in raw_housenumber) + 1);
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION display_housenumber(raw_housenumber text)
|
||||
RETURNS text AS $$
|
||||
SELECT CASE
|
||||
WHEN raw_housenumber !~ ';' THEN raw_housenumber
|
||||
WHEN raw_housenumber ~ '[^0-9;]' THEN display_housenumber_nonnumeric(raw_housenumber)
|
||||
ELSE
|
||||
(SELECT min(value)::text || '–' || max(value)::text
|
||||
FROM unnest(array_remove(string_to_array(raw_housenumber, ';'), '')::bigint[]) AS value)
|
||||
END
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
@ -26,7 +26,7 @@ layer:
|
||||
rock:
|
||||
subclass: ['bare_rock', 'scree']
|
||||
grass:
|
||||
subclass: ['fell', 'grassland', 'heath', 'scrub', 'shrubbery', 'tundra', 'grass', 'meadow', 'allotments', 'park', 'village_green', 'recreation_ground', 'garden', 'golf_course']
|
||||
subclass: ['fell', 'flowerbed', 'grassland', 'heath', 'scrub', 'shrubbery', 'tundra', 'grass', 'meadow', 'allotments', 'park', 'village_green', 'recreation_ground', 'garden', 'golf_course']
|
||||
wetland:
|
||||
subclass: ['wetland', 'bog', 'swamp', 'wet_meadow', 'marsh', 'reedbed', 'saltern', 'tidalflat', 'saltmarsh', 'mangrove']
|
||||
sand:
|
||||
@ -50,6 +50,7 @@ layer:
|
||||
- farm
|
||||
- farmland
|
||||
- fell
|
||||
- flowerbed
|
||||
- forest
|
||||
- garden
|
||||
- glacier
|
||||
|
||||
@ -18,6 +18,7 @@ tables:
|
||||
- farm
|
||||
- farmland
|
||||
- orchard
|
||||
- flowerbed
|
||||
- plant_nursery
|
||||
- vineyard
|
||||
- grass
|
||||
|
||||
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 68 KiB |
@ -137,6 +137,8 @@
|
||||
"#f5dcba",
|
||||
"farmland",
|
||||
"#eef0d5",
|
||||
"flowerbed",
|
||||
"#cdebb0",
|
||||
"forest",
|
||||
"#add19e",
|
||||
"grass",
|
||||
@ -201,6 +203,7 @@
|
||||
"scrub",
|
||||
"farm",
|
||||
"farmland",
|
||||
"flowerbed",
|
||||
"forest",
|
||||
"garden",
|
||||
"grass",
|
||||
@ -275,6 +278,8 @@
|
||||
"wetland_bog",
|
||||
"scrub",
|
||||
"scrub",
|
||||
"flowerbed",
|
||||
"flowerbed_high_zoom",
|
||||
"forest",
|
||||
"leaftype_unknown",
|
||||
"garden",
|
||||
@ -320,6 +325,7 @@
|
||||
"scrub",
|
||||
"farm",
|
||||
"farmland",
|
||||
"flowerbed",
|
||||
"forest",
|
||||
"garden",
|
||||
"grass",
|
||||
|
||||
@ -55,9 +55,9 @@ SELECT
|
||||
FROM (
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
name,
|
||||
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
||||
NULLIF(name, '') as name,
|
||||
COALESCE(NULLIF(name_en, ''), NULLIF(name, '')) AS name_en,
|
||||
COALESCE(NULLIF(name_de, ''), NULLIF(name, ''), NULLIF(name_en, '')) AS name_de,
|
||||
tags,
|
||||
substring(ele FROM E'^(-?\\d+)(\\D|$)')::int AS ele,
|
||||
round(substring(ele FROM E'^(-?\\d+)(\\D|$)')::int * 3.2808399)::int AS ele_ft,
|
||||
@ -65,15 +65,17 @@ FROM (
|
||||
row_number() OVER (
|
||||
PARTITION BY LabelGrid(geometry, 100 * pixel_width)
|
||||
ORDER BY (
|
||||
substring(ele FROM E'^(-?\\d+)(\\D|$)')::int +
|
||||
(CASE WHEN ele <> '' THEN substring(ele FROM E'^(-?\\d+)(\\D|$)')::int ELSE 0 END) +
|
||||
(CASE WHEN wikipedia <> '' THEN 10000 ELSE 0 END) +
|
||||
(CASE WHEN name <> '' THEN 10000 ELSE 0 END)
|
||||
) DESC
|
||||
)::int AS "rank"
|
||||
FROM peak_point
|
||||
WHERE geometry && bbox
|
||||
AND ele IS NOT NULL
|
||||
AND ele ~ E'^-?\\d{1,4}(\\D|$)'
|
||||
AND (
|
||||
(ele <> '' AND ele ~ E'^-?\\d{1,4}(\\D|$)')
|
||||
OR name <> ''
|
||||
)
|
||||
) AS ranked_peaks
|
||||
WHERE zoom_level >= 7
|
||||
AND (rank <= 5 OR zoom_level >= 14)
|
||||
|
||||
@ -8,9 +8,9 @@ layer:
|
||||
buffer_size: 64
|
||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the peak.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the peak. Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
class:
|
||||
description: |
|
||||
Use the **class** to differentiate between natural objects.
|
||||
|
||||
@ -6,6 +6,15 @@
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "mountain_peak",
|
||||
"maxzoom": 16,
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"!in",
|
||||
"class",
|
||||
"cliff",
|
||||
"volcano"
|
||||
]
|
||||
],
|
||||
"layout": {
|
||||
"text-size": 10,
|
||||
"icon-image": "peak",
|
||||
@ -38,15 +47,55 @@
|
||||
"text-halo-color": "rgba(255, 255, 255, .8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"order": 197
|
||||
},
|
||||
{
|
||||
"id": "mountain_peak_volcano",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "mountain_peak",
|
||||
"maxzoom": 16,
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"!=",
|
||||
"==",
|
||||
"class",
|
||||
"cliff"
|
||||
"volcano"
|
||||
]
|
||||
],
|
||||
"order": 192
|
||||
"layout": {
|
||||
"text-size": 10,
|
||||
"icon-image": "volcano",
|
||||
"text-field": {
|
||||
"stops": [
|
||||
[
|
||||
6,
|
||||
" "
|
||||
],
|
||||
[
|
||||
12,
|
||||
"{name} {ele}m"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-anchor": "top",
|
||||
"text-offset": [
|
||||
0,
|
||||
0.5
|
||||
],
|
||||
"text-max-width": 6,
|
||||
"text-line-height": 1.1,
|
||||
"text-font": [
|
||||
"Noto Sans Regular",
|
||||
"Noto Sans Italic"
|
||||
]
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#d40000",
|
||||
"text-halo-color": "rgba(255, 255, 255, .8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"order": 198
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -71,12 +71,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_mountain_linestring
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE mountain_linestring.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_mountain_linestring
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE mountain_linestring.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -71,12 +71,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_peak_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE mountain_peak_point.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_peak_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE mountain_peak_point.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -101,4 +101,3 @@ tables:
|
||||
boundary:
|
||||
- national_park
|
||||
- protected_area
|
||||
- aboriginal_lands
|
||||
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@ -26,12 +26,11 @@ SELECT osm_id,
|
||||
FROM (
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
CASE WHEN boundary='aboriginal_lands' THEN 'aboriginal_lands'
|
||||
ELSE COALESCE(
|
||||
COALESCE(
|
||||
LOWER(REPLACE(NULLIF(protection_title, ''), ' ', '_')),
|
||||
NULLIF(boundary, ''),
|
||||
NULLIF(leisure, '')
|
||||
) END AS class,
|
||||
NULLIF(leisure, ''))
|
||||
AS class,
|
||||
name,
|
||||
name_en,
|
||||
name_de,
|
||||
@ -46,7 +45,7 @@ FROM (
|
||||
NULL AS name_de,
|
||||
NULL AS tags,
|
||||
NULL AS leisure,
|
||||
CASE WHEN boundary='aboriginal_lands' THEN boundary END AS boundary,
|
||||
NULL AS boundary,
|
||||
NULL AS protection_title
|
||||
FROM osm_park_polygon_dissolve_z4
|
||||
WHERE zoom_level = 4
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
layer:
|
||||
id: "park"
|
||||
description: |
|
||||
The park layer contains parks from OpenStreetMap tagged with
|
||||
[`boundary=national_park`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dnational_park),
|
||||
[`boundary=protected_area`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dprotected_area),
|
||||
or [`leisure=nature_reserve`](http://wiki.openstreetmap.org/wiki/Tag:leisure%3Dnature_reserve).
|
||||
The park layer in OpenMapTiles contains natural and protected areas from OpenStreetMap,
|
||||
such as parks tagged with [`boundary=national_park`](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dnational_park),
|
||||
[`boundary=protected_area`](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dprotected_area),
|
||||
or [`leisure=nature_reserve`](https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dnature_reserve).
|
||||
buffer_size: 4
|
||||
fields:
|
||||
class:
|
||||
description: |
|
||||
Use the **class** to differentiate between different parks.
|
||||
Use the **class** to differentiate between different kinds of features in the `parks` layer.
|
||||
The class for `boundary=protected_area` parks is the lower-case of the
|
||||
[`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
|
||||
value with blanks replaced by `_`.
|
||||
@ -17,10 +17,9 @@ layer:
|
||||
`nature_reserve` is the class of `protection_title=Nature Reserve` and `leisure=nature_reserve`.
|
||||
The class for other [`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
|
||||
values is similarly assigned.
|
||||
The class for `boundary=aboriginal_lands` is `aboriginal_lands`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the park (point features only).
|
||||
name_en: English name `name:en` if available, otherwise `name` (point features only).
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en` (point features only).
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the park (point features only). Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name` (point features only). This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en` (point features only). This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
rank: Rank of the park within one tile, starting at 1 that is the most important park (point features only).
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
|
||||
@ -48,8 +48,8 @@ DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z7;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z6;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z5;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z4;
|
||||
DROP TRIGGER IF EXISTS tigger_flag ON osm_park_polygon;
|
||||
DROP TRIGGER IF EXISTS tigger_refresh ON park_polygon.updates;
|
||||
DROP TRIGGER IF EXISTS trigger_flag ON osm_park_polygon;
|
||||
DROP TRIGGER IF EXISTS trigger_refresh ON park_polygon.updates;
|
||||
|
||||
-- etldoc: osm_park_polygon -> osm_park_polygon
|
||||
-- etldoc: osm_park_polygon_gen_z13 -> osm_park_polygon_gen_z13
|
||||
@ -67,43 +67,43 @@ $$
|
||||
BEGIN
|
||||
UPDATE osm_park_polygon
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z13
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z12
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z11
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z10
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z9
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z8
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z7
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z6
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z5
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
REFRESH MATERIALIZED VIEW CONCURRENTLY osm_park_polygon_dissolve_z4;
|
||||
END;
|
||||
@ -149,7 +149,7 @@ BEGIN
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE osm_park_polygon_gen_z4;
|
||||
REFRESH MATERIALIZED VIEW osm_park_polygon_dissolve_z4;
|
||||
REFRESH MATERIALIZED VIEW CONCURRENTLY osm_park_polygon_dissolve_z4;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM park_polygon.updates;
|
||||
@ -165,7 +165,7 @@ AS
|
||||
$$
|
||||
BEGIN
|
||||
NEW.tags = update_tags(NEW.tags, NEW.geometry);
|
||||
NEW.geometry_point = st_centroid(NEW.geometry);
|
||||
NEW.geometry_point = ST_PointOnSurface(NEW.geometry);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
@ -248,7 +248,7 @@ EXECUTE PROCEDURE update_osm_park_dissolved_polygon_row();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_park_polygon_gen_z4
|
||||
ON osm_park_polygon
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE park_polygon.flag();
|
||||
|
||||
|
||||
14
layers/place/area_rank.sql
Normal file
@ -0,0 +1,14 @@
|
||||
CREATE OR REPLACE FUNCTION area_rank(area real) RETURNS int AS
|
||||
$$
|
||||
SELECT CASE
|
||||
WHEN area > 640000000 THEN 1
|
||||
WHEN area > 160000000 THEN 2
|
||||
WHEN area > 40000000 THEN 3
|
||||
WHEN area > 15000000 THEN 4
|
||||
WHEN area > 10000000 THEN 5
|
||||
WHEN area > 0 THEN 6
|
||||
ELSE 7
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
STRICT
|
||||
PARALLEL SAFE;
|
||||
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 152 KiB |
@ -1,12 +0,0 @@
|
||||
CREATE OR REPLACE FUNCTION island_rank(area real) RETURNS int AS
|
||||
$$
|
||||
SELECT CASE
|
||||
WHEN area < 10000000 THEN 6
|
||||
WHEN area BETWEEN 1000000 AND 15000000 THEN 5
|
||||
WHEN area BETWEEN 15000000 AND 40000000 THEN 4
|
||||
WHEN area > 40000000 THEN 3
|
||||
ELSE 7
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
STRICT
|
||||
PARALLEL SAFE;
|
||||
@ -109,17 +109,39 @@ FROM (
|
||||
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
||||
tags,
|
||||
'island' AS class,
|
||||
island_rank(area) AS "rank",
|
||||
area_rank(area) AS "rank",
|
||||
NULL::int AS capital,
|
||||
NULL::text AS iso_a2
|
||||
FROM osm_island_polygon
|
||||
WHERE geometry && bbox
|
||||
AND ((zoom_level = 8 AND island_rank(area) <= 3)
|
||||
OR (zoom_level = 9 AND island_rank(area) <= 4)
|
||||
AND ((zoom_level = 8 AND area_rank(area) <= 3)
|
||||
OR (zoom_level = 9 AND area_rank(area) <= 4)
|
||||
OR (zoom_level >= 10))
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
-- etldoc: osm_boundary_polygon -> layer_place:z6_11
|
||||
-- etldoc: osm_boundary_polygon -> layer_place:z12_14
|
||||
osm_id * 10 AS osm_id,
|
||||
geometry_point,
|
||||
name,
|
||||
NULL::text AS name_en, -- deprecated
|
||||
NULL::text AS name_de, -- deprecated
|
||||
tags,
|
||||
'aboriginal_lands' AS class,
|
||||
area_rank(area) AS "rank",
|
||||
NULL::int AS capital,
|
||||
NULL::text AS iso_a2
|
||||
FROM osm_boundary_polygon
|
||||
WHERE geometry_point && bbox
|
||||
AND ((zoom_level = 6 AND area_rank(area) <= 1)
|
||||
OR (zoom_level = 7 AND area_rank(area) <= 2)
|
||||
OR (zoom_level = 8 AND area_rank(area) <= 3)
|
||||
OR (zoom_level = 9 AND area_rank(area) <= 4)
|
||||
OR (zoom_level >= 10))
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
-- etldoc: layer_city -> layer_place:z0_3
|
||||
-- etldoc: layer_city -> layer_place:z4_7
|
||||
|
||||
@ -5,6 +5,8 @@ layer:
|
||||
- ne_10m_admin_1_states_provinces
|
||||
- ne_10m_admin_0_countries
|
||||
- ne_10m_populated_places
|
||||
layers:
|
||||
- boundary
|
||||
description: |
|
||||
The place layer consists out of [countries](http://wiki.openstreetmap.org/wiki/Tag:place%3Dcountry),
|
||||
[states](http://wiki.openstreetmap.org/wiki/Tag:place%3Dstate), [cities](http://wiki.openstreetmap.org/wiki/Key:place)
|
||||
@ -12,9 +14,9 @@ layer:
|
||||
Apart from the roads this is also one of the more important layers to create a beautiful map.
|
||||
We suggest you use different font styles and sizes to create a text hierarchy.
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the place. Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
capital:
|
||||
description: |
|
||||
The **capital** field marks the
|
||||
@ -28,7 +30,9 @@ layer:
|
||||
Distinguish between continents, countries, states, islands and
|
||||
places like settlements or smaller entities.
|
||||
Use **class** to separately style the different places and build
|
||||
a text hierarchy according to their importance.
|
||||
a text hierarchy according to their importance. For places derived
|
||||
from boundaries, the original value of the
|
||||
[`boundary`](http://wiki.openstreetmap.org/wiki/Key:boundary) tag.
|
||||
values:
|
||||
- continent
|
||||
- country
|
||||
@ -44,6 +48,7 @@ layer:
|
||||
- neighbourhood
|
||||
- isolated_dwelling
|
||||
- island
|
||||
- aboriginal_lands
|
||||
iso_a2:
|
||||
description: |
|
||||
Two-letter country code [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Available only for `class=country`.
|
||||
@ -75,7 +80,7 @@ schema:
|
||||
- ./types.sql
|
||||
- ./capital.sql
|
||||
- ./city.sql
|
||||
- ./island_rank.sql
|
||||
- ./area_rank.sql
|
||||
- ./update_continent_point.sql
|
||||
- ./update_country_point.sql
|
||||
- ./update_island_polygon.sql
|
||||
|
||||
@ -129,7 +129,7 @@
|
||||
"village"
|
||||
]
|
||||
],
|
||||
"order": 193
|
||||
"order": 199
|
||||
},
|
||||
{
|
||||
"id": "place_town",
|
||||
@ -177,7 +177,7 @@
|
||||
"town"
|
||||
]
|
||||
],
|
||||
"order": 194
|
||||
"order": 200
|
||||
},
|
||||
{
|
||||
"id": "place_state",
|
||||
@ -228,7 +228,7 @@
|
||||
3
|
||||
]
|
||||
],
|
||||
"order": 195
|
||||
"order": 201
|
||||
},
|
||||
{
|
||||
"id": "place_city",
|
||||
@ -311,7 +311,7 @@
|
||||
1
|
||||
]
|
||||
],
|
||||
"order": 196
|
||||
"order": 202
|
||||
},
|
||||
{
|
||||
"id": "place_capital",
|
||||
@ -396,7 +396,7 @@
|
||||
2
|
||||
]
|
||||
],
|
||||
"order": 197
|
||||
"order": 203
|
||||
},
|
||||
{
|
||||
"id": "country_other",
|
||||
@ -449,7 +449,7 @@
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 198
|
||||
"order": 204
|
||||
},
|
||||
{
|
||||
"id": "country_3",
|
||||
@ -518,7 +518,7 @@
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 199
|
||||
"order": 205
|
||||
},
|
||||
{
|
||||
"id": "country_2",
|
||||
@ -587,7 +587,7 @@
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 200
|
||||
"order": 206
|
||||
},
|
||||
{
|
||||
"id": "country_1",
|
||||
@ -656,7 +656,7 @@
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 201
|
||||
"order": 207
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -49,8 +49,6 @@ $$ LANGUAGE SQL;
|
||||
|
||||
SELECT update_osm_city_point(true);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_city_point_rank_idx ON osm_city_point ("rank");
|
||||
|
||||
-- Handle updates
|
||||
|
||||
CREATE OR REPLACE FUNCTION place_city.store() RETURNS trigger AS
|
||||
@ -101,12 +99,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_city_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_city.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_city_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_city.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -71,12 +71,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_continent_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_continent_point.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_continent_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_continent_point.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -98,8 +98,6 @@ $$ LANGUAGE SQL;
|
||||
|
||||
SELECT update_osm_country_point(true);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_country_point_rank_idx ON osm_country_point ("rank");
|
||||
|
||||
-- Handle updates
|
||||
|
||||
CREATE OR REPLACE FUNCTION place_country.store() RETURNS trigger AS
|
||||
@ -150,12 +148,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_country_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_country.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_country_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_country.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -71,12 +71,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_island_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_island_point.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_island_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_island_point.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -78,12 +78,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_island_polygon
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_island_polygon.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_island_polygon
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_island_polygon.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -60,8 +60,6 @@ $$ LANGUAGE SQL;
|
||||
|
||||
SELECT update_osm_state_point(true);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_state_point_rank_idx ON osm_state_point ("rank");
|
||||
|
||||
-- Handle updates
|
||||
|
||||
CREATE OR REPLACE FUNCTION place_state.store() RETURNS trigger AS
|
||||
@ -112,12 +110,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_state_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_state.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_state_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE place_state.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -76,6 +76,8 @@ CREATE OR REPLACE FUNCTION poi_class(subclass text, mapping_key text, subtype te
|
||||
RETURNS text AS
|
||||
$$
|
||||
SELECT CASE
|
||||
-- Special case subclass collision between office=university and amenity=university
|
||||
WHEN mapping_key = 'amenity' AND subclass = 'university' THEN 'college'
|
||||
%%FIELD_MAPPING: class %%
|
||||
ELSE subclass
|
||||
END;
|
||||
|
||||
@ -18,6 +18,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity
|
||||
- biergarten
|
||||
- bus_station
|
||||
- cafe
|
||||
- charging_station
|
||||
- cinema
|
||||
- clinic
|
||||
- college
|
||||
@ -124,7 +125,66 @@ def_poi_mapping_leisure: &poi_mapping_leisure
|
||||
|
||||
# office values , see http://taginfo.openstreetmap.org/keys/office#values
|
||||
def_poi_mapping_office: &poi_mapping_office
|
||||
- accountant
|
||||
- advertising_agency
|
||||
- architect
|
||||
- association
|
||||
- bail_bond_agent
|
||||
- charity
|
||||
- company
|
||||
- construction_company
|
||||
- consulting
|
||||
- cooperative
|
||||
- courier
|
||||
- coworking
|
||||
- diplomatic
|
||||
- educational_institution
|
||||
- employment_agency
|
||||
- energy_supplier
|
||||
- engineer
|
||||
- estate_agent
|
||||
- financial
|
||||
- financial_advisor
|
||||
- forestry
|
||||
- foundation
|
||||
- geodesist
|
||||
- government
|
||||
- graphic_design
|
||||
- guide
|
||||
- harbour_master
|
||||
- health_insurance
|
||||
- insurance
|
||||
- interior_design
|
||||
- it
|
||||
- lawyer
|
||||
- logistics
|
||||
- marketing
|
||||
- moving_company
|
||||
- newspaper
|
||||
- ngo
|
||||
- notary
|
||||
- physician
|
||||
- political_party
|
||||
- private_investigator
|
||||
- property_management
|
||||
- publisher
|
||||
- quango
|
||||
- religion
|
||||
- research
|
||||
- security
|
||||
- surveyor
|
||||
- tax_advisor
|
||||
- taxi
|
||||
- telecommunication
|
||||
- therapist
|
||||
- translator
|
||||
- travel_agent
|
||||
- tutoring
|
||||
- union
|
||||
- university
|
||||
- water_utility
|
||||
- web_design
|
||||
- wedding_planner
|
||||
|
||||
# railway values , see http://taginfo.openstreetmap.org/keys/railway#values
|
||||
def_poi_mapping_railway: &poi_mapping_railway
|
||||
@ -199,6 +259,7 @@ def_poi_mapping_shop: &poi_mapping_shop
|
||||
- newsagent
|
||||
- optician
|
||||
- outdoor
|
||||
- paint
|
||||
- perfume
|
||||
- perfumery
|
||||
- pet
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.7 MiB |
@ -116,7 +116,7 @@ FROM (
|
||||
ELSE osm_id * 10 + 1
|
||||
END AS osm_id_hash
|
||||
FROM osm_poi_polygon
|
||||
WHERE geometry && bbox AND
|
||||
WHERE zoom_level > 9 AND geometry && bbox AND
|
||||
CASE
|
||||
WHEN zoom_level >= 14 THEN TRUE
|
||||
WHEN zoom_level >= 12 AND
|
||||
|
||||
@ -6,9 +6,9 @@ layer:
|
||||
buffer_size: 64
|
||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI. Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
class:
|
||||
description: |
|
||||
More general classes of POIs. If there is no more general `class` for the `subclass`
|
||||
@ -17,40 +17,50 @@ layer:
|
||||
and `kindergarten`. Or use the class `shop` to style all shops.
|
||||
values:
|
||||
shop:
|
||||
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist',
|
||||
'coffee', 'computer', 'convenience', 'copyshop', 'cosmetics', 'garden_centre', 'doityourself',
|
||||
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist', 'chocolate',
|
||||
'coffee', 'computer', 'convenience', 'confectionery', 'copyshop', 'cosmetics', 'garden_centre', 'doityourself',
|
||||
'erotic', 'electronics', 'fabric', 'florist', 'frozen_food', 'furniture', 'video_games', 'video',
|
||||
'general', 'gift', 'hardware', 'hearing_aids', 'hifi', 'ice_cream', 'interior_decoration',
|
||||
'jewelry', 'kiosk', 'locksmith', 'lamps', 'mall', 'massage', 'motorcycle', 'mobile_phone',
|
||||
'newsagent', 'optician', 'outdoor', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand', 'shoes', 'sports',
|
||||
'newsagent', 'optician', 'outdoor', 'paint', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand', 'shoes', 'sports',
|
||||
'stationery', 'tailor', 'tattoo', 'ticket', 'tobacco', 'toys', 'travel_agency',
|
||||
'watches', 'weapons', 'wholesale' ]
|
||||
optician:
|
||||
subclass: [ 'optician' ]
|
||||
toys:
|
||||
subclass: [ 'toys' ]
|
||||
jewelry:
|
||||
subclass: [ 'jewelry' ]
|
||||
furniture:
|
||||
subclass: [ 'furniture' ]
|
||||
newsagent:
|
||||
subclass: [ 'newsagent' ]
|
||||
paint:
|
||||
subclass: [ 'paint' ]
|
||||
beverages:
|
||||
subclass: [ 'beverages' ]
|
||||
electronics:
|
||||
subclass: [ 'electronics' ]
|
||||
garden_centre:
|
||||
subclass: [ 'garden_centre' ]
|
||||
mobile_phone:
|
||||
subclass: [ 'mobile_phone' ]
|
||||
shoes:
|
||||
subclass: [ 'shoes' ]
|
||||
hardware:
|
||||
subclass: [ 'hardware', 'doityourself' ]
|
||||
florist:
|
||||
subclass: [ 'florist' ]
|
||||
office:
|
||||
subclass: ['accountant', 'advertising_agency', 'architect', 'association', 'bail_bond_agent', 'charity',
|
||||
'company', 'construction_company', 'consulting', 'cooperative', 'courier', 'coworking', 'diplomatic',
|
||||
'educational_institution', 'employment_agency', 'energy_supplier', 'engineer', 'estate_agent', 'financial',
|
||||
'financial_advisor', 'forestry', 'foundation', 'geodesist', 'government', 'graphic_design', 'guide',
|
||||
'harbour_master', 'health_insurance', 'insurance', 'interior_design', 'it', 'lawyer', 'logistics', 'marketing',
|
||||
'moving_company', 'newspaper', 'ngo', 'notary', 'physician', 'political_party', 'private_investigator',
|
||||
'property_management', 'publisher', 'quango', 'religion', 'research', 'security', 'surveyor', 'tax_advisor',
|
||||
'taxi', 'telecommunication', 'therapist', 'translator', 'travel_agent', 'tutoring', 'union', 'university',
|
||||
'water_utility', 'web_design', 'wedding_planner']
|
||||
# optician:
|
||||
# subclass: [ 'optician' ]
|
||||
# toys:
|
||||
# subclass: [ 'toys' ]
|
||||
# jewelry:
|
||||
# subclass: [ 'jewelry' ]
|
||||
# furniture:
|
||||
# subclass: [ 'furniture' ]
|
||||
# newsagent:
|
||||
# subclass: [ 'newsagent' ]
|
||||
# paint:
|
||||
# subclass: [ 'paint' ]
|
||||
# beverages:
|
||||
# subclass: [ 'beverages' ]
|
||||
# electronics:
|
||||
# subclass: [ 'electronics' ]
|
||||
# garden_centre:
|
||||
# subclass: [ 'garden_centre' ]
|
||||
# mobile_phone:
|
||||
# subclass: [ 'mobile_phone' ]
|
||||
# shoes:
|
||||
# subclass: [ 'shoes' ]
|
||||
# hardware:
|
||||
# subclass: [ 'hardware', 'doityourself' ]
|
||||
# florist:
|
||||
# subclass: [ 'florist' ]
|
||||
town_hall:
|
||||
subclass: ['townhall', 'public_building', 'courthouse']
|
||||
community_centre:
|
||||
@ -87,7 +97,7 @@ layer:
|
||||
lodging:
|
||||
subclass: ['hotel', 'motel', 'bed_and_breakfast', 'guest_house', 'hostel', 'chalet', 'alpine_hut', 'dormitory']
|
||||
ice_cream:
|
||||
subclass: ['chocolate', 'confectionery', 'ice_cream']
|
||||
subclass: ['ice_cream', 'ice_cream']
|
||||
post:
|
||||
subclass: ['post_box', 'post_office', 'parcel_locker']
|
||||
cafe:
|
||||
@ -130,6 +140,8 @@ layer:
|
||||
subclass: ['castle', 'ruins']
|
||||
atm:
|
||||
subclass: ['atm']
|
||||
fuel:
|
||||
subclass: ['fuel', 'charging_station']
|
||||
airport:
|
||||
subclass: [ 'aerodrome' ]
|
||||
heliport:
|
||||
|
||||
@ -22,7 +22,37 @@
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": "{subclass}",
|
||||
"icon-image": [
|
||||
"coalesce",
|
||||
[
|
||||
"image",
|
||||
[
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
],
|
||||
"chocolate",
|
||||
"confectionery",
|
||||
"wine",
|
||||
"alcohol",
|
||||
"kiosk",
|
||||
"newsagent",
|
||||
"perfume",
|
||||
"perfumery",
|
||||
"wholesale",
|
||||
"trade",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
"image",
|
||||
"shop"
|
||||
]
|
||||
],
|
||||
"text-field": "{name:latin}\n{name:nonlatin}",
|
||||
"visibility": "visible",
|
||||
"text-anchor": "top",
|
||||
@ -35,16 +65,7 @@
|
||||
"icon-allow-overlap": true
|
||||
},
|
||||
"paint": {
|
||||
"text-color": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
"ice_cream",
|
||||
"#C77400",
|
||||
"#939"
|
||||
],
|
||||
"text-color": "#939",
|
||||
"icon-opacity": 1,
|
||||
"icon-halo-blur": 1,
|
||||
"text-halo-blur": 0.5,
|
||||
@ -72,7 +93,9 @@
|
||||
"subclass",
|
||||
"mall",
|
||||
"library",
|
||||
"artwork"
|
||||
"artwork",
|
||||
"arts_centre",
|
||||
"gallery"
|
||||
]
|
||||
],
|
||||
"order": 150
|
||||
@ -99,7 +122,19 @@
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": "{subclass}",
|
||||
"icon-image": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
],
|
||||
"chocolate",
|
||||
"confectionery",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
]
|
||||
],
|
||||
"text-field": "{name:latin}\n{name:nonlatin}",
|
||||
"visibility": "visible",
|
||||
"text-anchor": "top",
|
||||
@ -112,16 +147,7 @@
|
||||
"icon-allow-overlap": true
|
||||
},
|
||||
"paint": {
|
||||
"text-color": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
"ice_cream",
|
||||
"#C77400",
|
||||
"#939"
|
||||
],
|
||||
"text-color": "#939",
|
||||
"icon-opacity": 1,
|
||||
"icon-halo-blur": 1,
|
||||
"text-halo-blur": 0.5,
|
||||
@ -743,7 +769,27 @@
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": "{subclass}",
|
||||
"icon-image": [
|
||||
"coalesce",
|
||||
[
|
||||
"image",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
]
|
||||
],
|
||||
[
|
||||
"image",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
]
|
||||
],
|
||||
[
|
||||
"image",
|
||||
""
|
||||
]
|
||||
],
|
||||
"text-field": "{name:latin}\n{name:nonlatin}",
|
||||
"visibility": "visible",
|
||||
"text-anchor": "top",
|
||||
@ -778,7 +824,8 @@
|
||||
"information",
|
||||
"cinema",
|
||||
"theatre",
|
||||
"fire_station"
|
||||
"fire_station",
|
||||
"office"
|
||||
],
|
||||
[
|
||||
"!=",
|
||||
@ -840,7 +887,6 @@
|
||||
"class",
|
||||
"cinema",
|
||||
"library",
|
||||
"music",
|
||||
"museum",
|
||||
"castle",
|
||||
"monument",
|
||||
@ -850,9 +896,7 @@
|
||||
"!in",
|
||||
"subclass",
|
||||
"books",
|
||||
"musical_instrument",
|
||||
"art",
|
||||
"gallery"
|
||||
"art"
|
||||
]
|
||||
],
|
||||
"order": 163
|
||||
@ -976,7 +1020,8 @@
|
||||
"class",
|
||||
"car",
|
||||
"bicycle_parking",
|
||||
"fuel"
|
||||
"fuel",
|
||||
"charging_station"
|
||||
]
|
||||
],
|
||||
"order": 165
|
||||
|
||||
@ -43,11 +43,11 @@ BEGIN
|
||||
-- (using name for parcel lockers is discouraged, see osm wiki)
|
||||
UPDATE osm_poi_point
|
||||
SET (name, tags) = (
|
||||
CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref')),
|
||||
tags || hstore('name', CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref')))
|
||||
TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))),
|
||||
tags || hstore('name', TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))))
|
||||
)
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
|
||||
AND subclass = 'parcel_locker'
|
||||
AND subclass IN ('parcel_locker', 'charging_station')
|
||||
AND name = ''
|
||||
AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL;
|
||||
|
||||
@ -155,12 +155,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_poi_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE poi_point.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_poi_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE poi_point.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -36,6 +36,19 @@ $$
|
||||
AND funicular = 'yes'
|
||||
AND subclass = 'station';
|
||||
|
||||
-- Parcel locker and charging_station without name
|
||||
-- use either brand or operator and add ref if present
|
||||
-- (using name for parcel lockers is discouraged, see osm wiki)
|
||||
UPDATE osm_poi_polygon
|
||||
SET (name, tags) = (
|
||||
TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))),
|
||||
tags || hstore('name', TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))))
|
||||
)
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_polygon.osm_ids))
|
||||
AND subclass IN ('parcel_locker', 'charging_station')
|
||||
AND name = ''
|
||||
AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL;
|
||||
|
||||
UPDATE osm_poi_polygon
|
||||
SET tags = update_tags(tags, geometry)
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_polygon.osm_ids))
|
||||
@ -96,12 +109,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_poi_polygon
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE poi_polygon.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_poi_polygon
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE poi_polygon.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
|
Before Width: | Height: | Size: 772 KiB After Width: | Height: | Size: 865 KiB |
@ -102,10 +102,6 @@ name_de_field: &name_de
|
||||
name: name_de
|
||||
key: name:de
|
||||
type: string
|
||||
short_name_field: &short_name
|
||||
key: short_name
|
||||
name: short_name
|
||||
type: string
|
||||
tunnel_field: &tunnel
|
||||
key: tunnel
|
||||
name: is_tunnel
|
||||
@ -236,7 +232,6 @@ tables:
|
||||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
@ -316,12 +311,10 @@ tables:
|
||||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
- *ford
|
||||
- *oneway
|
||||
- *area
|
||||
- *service
|
||||
- *usage
|
||||
@ -355,7 +348,6 @@ tables:
|
||||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
@ -394,12 +386,10 @@ tables:
|
||||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
- *ford
|
||||
- *oneway
|
||||
- *area
|
||||
- *service
|
||||
- *usage
|
||||
@ -493,6 +483,9 @@ tables:
|
||||
- name: colour
|
||||
key: colour
|
||||
type: string
|
||||
- name: ref_colour
|
||||
key: ref:colour
|
||||
type: string
|
||||
mapping:
|
||||
route:
|
||||
- road
|
||||
|
||||
@ -17,7 +17,9 @@ $$
|
||||
'us-interstate', 'us-highway', 'us-state',
|
||||
'ca-transcanada', 'ca-provincial-arterial', 'ca-provincial',
|
||||
'gb-motorway', 'gb-trunk', 'gb-primary',
|
||||
'ie-motorway', 'ie-national', 'ie-regional'
|
||||
'ie-motorway', 'ie-national', 'ie-regional',
|
||||
'e-road',
|
||||
'a-road'
|
||||
);
|
||||
END
|
||||
$$;
|
||||
@ -29,6 +31,27 @@ $$
|
||||
-- Canada
|
||||
'ca-transcanada', 'ca-provincial-arterial',
|
||||
-- United States
|
||||
'us-interstate');
|
||||
'us-interstate', 'us-highway',
|
||||
-- UK
|
||||
'gb-motorway', 'gb-trunk',
|
||||
-- Ireland
|
||||
'ie-motorway', 'ie-national',
|
||||
-- Europe
|
||||
'e-road',
|
||||
-- Asia
|
||||
'a-road'
|
||||
);
|
||||
$$ LANGUAGE sql IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION create_route_hstore(network TEXT, ref TEXT, name TEXT, colour TEXT, ref_colour TEXT)
|
||||
RETURNS hstore AS $$
|
||||
SELECT CASE
|
||||
WHEN network = '' THEN hstore('')
|
||||
ELSE hstore(
|
||||
ARRAY['network', 'ref', 'name', 'colour'],
|
||||
ARRAY[network, NULLIF(ref, ''), NULLIF(name, ''), COALESCE(NULLIF(colour, ''), NULLIF(ref_colour, ''))]
|
||||
)
|
||||
END;
|
||||
$$ LANGUAGE sql IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
@ -4529,37 +4529,21 @@
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
[
|
||||
"geometry-type"
|
||||
],
|
||||
"$type",
|
||||
"LineString"
|
||||
],
|
||||
[
|
||||
"all",
|
||||
[
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"brunnel"
|
||||
],
|
||||
[
|
||||
"!in",
|
||||
"brunnel",
|
||||
"bridge",
|
||||
"tunnel"
|
||||
],
|
||||
false,
|
||||
true
|
||||
],
|
||||
[
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"minor"
|
||||
],
|
||||
true,
|
||||
false
|
||||
]
|
||||
]
|
||||
],
|
||||
@ -4633,37 +4617,21 @@
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
[
|
||||
"geometry-type"
|
||||
],
|
||||
"$type",
|
||||
"LineString"
|
||||
],
|
||||
[
|
||||
"all",
|
||||
[
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"brunnel"
|
||||
],
|
||||
[
|
||||
"!in",
|
||||
"brunnel",
|
||||
"bridge",
|
||||
"tunnel"
|
||||
],
|
||||
false,
|
||||
true
|
||||
],
|
||||
[
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"minor_construction"
|
||||
],
|
||||
true,
|
||||
false
|
||||
]
|
||||
]
|
||||
],
|
||||
@ -5607,7 +5575,7 @@
|
||||
"stops": [
|
||||
[
|
||||
8,
|
||||
" #787878"
|
||||
"#787878"
|
||||
],
|
||||
[
|
||||
14,
|
||||
|
||||
@ -62,7 +62,7 @@ SELECT osm_id,
|
||||
NULLIF(service, '') AS service,
|
||||
access,
|
||||
CASE WHEN toll = TRUE THEN 1 END AS toll,
|
||||
CASE WHEN highway NOT IN ('', 'motorway') AND expressway = TRUE THEN 1 END AS expressway,
|
||||
CASE WHEN highway NOT IN ('', 'motorway') AND NOT is_ramp AND expressway = TRUE THEN 1 END AS expressway,
|
||||
NULLIF(layer, 0) AS layer,
|
||||
"level",
|
||||
CASE WHEN indoor = TRUE THEN 1 END AS indoor,
|
||||
@ -372,7 +372,7 @@ FROM (
|
||||
hl.z_order
|
||||
FROM osm_highway_linestring hl
|
||||
LEFT OUTER JOIN osm_transportation_name_network n ON hl.osm_id = n.osm_id
|
||||
WHERE NOT is_area
|
||||
WHERE zoom_level > 11 AND NOT is_area
|
||||
AND
|
||||
CASE WHEN zoom_level = 12 THEN
|
||||
CASE WHEN transportation_filter_z12(hl.highway, hl.construction) THEN TRUE
|
||||
@ -483,7 +483,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -518,7 +518,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -553,7 +553,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -589,7 +589,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -625,7 +625,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -659,7 +659,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -692,7 +692,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -725,7 +725,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -758,7 +758,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -791,7 +791,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -824,7 +824,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -857,7 +857,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -890,7 +890,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -923,7 +923,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -956,7 +956,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
@ -990,7 +990,7 @@ FROM (
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
||||
@ -48,6 +48,7 @@ WHERE length(ref) > 1
|
||||
CREATE OR REPLACE FUNCTION osm_route_member_network_type(network text, ref text) RETURNS route_network_type AS
|
||||
$$
|
||||
SELECT CASE
|
||||
-- https://wiki.openstreetmap.org/wiki/United_States_roads_tagging
|
||||
WHEN network = 'US:I' THEN 'us-interstate'::route_network_type
|
||||
WHEN network = 'US:US' THEN 'us-highway'::route_network_type
|
||||
WHEN network LIKE 'US:__' THEN 'us-state'::route_network_type
|
||||
@ -58,7 +59,7 @@ SELECT CASE
|
||||
CASE
|
||||
WHEN ref LIKE '4__' THEN 'ca-provincial-arterial'::route_network_type
|
||||
WHEN ref = 'QEW' THEN 'ca-provincial-arterial'::route_network_type
|
||||
ELSE 'ca-provincial-arterial'::route_network_type
|
||||
ELSE 'ca-provincial'::route_network_type
|
||||
END
|
||||
WHEN network = 'CA:MB:PTH' AND ref = '75' THEN 'ca-provincial-arterial'::route_network_type
|
||||
WHEN network = 'CA:AB:primary' AND ref IN ('2','3','4') THEN 'ca-provincial-arterial'::route_network_type
|
||||
@ -85,6 +86,7 @@ CREATE TABLE IF NOT EXISTS transportation_route_member_coalesced
|
||||
name varchar,
|
||||
osmc_symbol varchar,
|
||||
colour varchar,
|
||||
ref_colour varchar,
|
||||
network_type route_network_type,
|
||||
concurrency_index integer,
|
||||
rank integer,
|
||||
@ -104,33 +106,6 @@ BEGIN
|
||||
USING transportation_name.network_changes c
|
||||
WHERE c.is_old IS TRUE AND transportation_route_member_coalesced.member = c.osm_id;
|
||||
|
||||
-- Create GBR/IRE relations (so we can use it in the same way as other relations)
|
||||
-- etldoc: gbr_route_members_view -> transportation_route_member_coalesced
|
||||
INSERT INTO transportation_route_member_coalesced (member, network, ref, network_type, concurrency_index, osm_id)
|
||||
SELECT member, network, ref, osm_route_member_network_type(network, ref) AS network_type,
|
||||
1 AS concurrency_index, 0 AS osm_id
|
||||
FROM gbr_route_members_view
|
||||
WHERE full_update OR EXISTS(
|
||||
SELECT NULL
|
||||
FROM transportation_name.network_changes c
|
||||
WHERE c.is_old IS FALSE AND c.osm_id = gbr_route_members_view.member
|
||||
)
|
||||
GROUP BY member, network, ref
|
||||
ON CONFLICT (member, network, ref) DO NOTHING;
|
||||
|
||||
-- etldoc: ire_route_members_view -> transportation_route_member_coalesced
|
||||
INSERT INTO transportation_route_member_coalesced (member, network, ref, network_type, concurrency_index, osm_id)
|
||||
SELECT member, network, ref, osm_route_member_network_type(network, ref) AS network_type,
|
||||
1 AS concurrency_index, 0 AS osm_id
|
||||
FROM ire_route_members_view
|
||||
WHERE full_update OR EXISTS(
|
||||
SELECT NULL
|
||||
FROM transportation_name.network_changes c
|
||||
WHERE c.is_old IS FALSE AND c.osm_id = ire_route_members_view.member
|
||||
)
|
||||
GROUP BY member, network, ref
|
||||
ON CONFLICT (member, network, ref) DO NOTHING;
|
||||
|
||||
-- etldoc: osm_route_member -> transportation_route_member_coalesced
|
||||
INSERT INTO transportation_route_member_coalesced
|
||||
SELECT
|
||||
@ -147,33 +122,40 @@ BEGIN
|
||||
END AS rank
|
||||
FROM (
|
||||
-- etldoc: osm_route_member -> osm_route_member
|
||||
-- etldoc: gbr_route_members_view -> osm_route_member
|
||||
-- etldoc: ire_route_members_view -> osm_route_member
|
||||
-- see http://wiki.openstreetmap.org/wiki/Relation:route#Road_routes
|
||||
SELECT DISTINCT ON (member, network, ref)
|
||||
member,
|
||||
network,
|
||||
ref,
|
||||
SELECT DISTINCT ON (member, COALESCE(rel.network, ''), COALESCE(rel.ref, ''))
|
||||
rel.member,
|
||||
COALESCE(NULLIF(rel.network,''), gb_way.network, ir_way.network, '') AS network,
|
||||
COALESCE(rel.ref, '') AS ref,
|
||||
osm_id,
|
||||
role,
|
||||
type,
|
||||
name,
|
||||
osmc_symbol,
|
||||
colour
|
||||
FROM osm_route_member
|
||||
colour,
|
||||
ref_colour
|
||||
FROM osm_route_member rel
|
||||
LEFT JOIN gbr_route_members_view gb_way ON (gb_way.member=rel.member)
|
||||
LEFT JOIN ire_route_members_view ir_way ON (ir_way.member=rel.member)
|
||||
WHERE full_update OR EXISTS(
|
||||
SELECT NULL
|
||||
FROM transportation_name.network_changes c
|
||||
WHERE c.is_old IS FALSE AND c.osm_id = osm_route_member.member
|
||||
WHERE c.is_old IS FALSE AND c.osm_id = rel.member
|
||||
)
|
||||
) osm_route_member_filtered
|
||||
ON CONFLICT (member, network, ref) DO UPDATE SET osm_id = EXCLUDED.osm_id, role = EXCLUDED.role,
|
||||
type = EXCLUDED.type, name = EXCLUDED.name,
|
||||
osmc_symbol = EXCLUDED.osmc_symbol, colour = EXCLUDED.colour,
|
||||
osmc_symbol = EXCLUDED.osmc_symbol, colour = EXCLUDED.colour, ref_colour = EXCLUDED.ref_colour,
|
||||
concurrency_index = EXCLUDED.concurrency_index,
|
||||
rank = EXCLUDED.rank;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- Indexes which can be utilized during full-update for queries originating from update_osm_route_member() function
|
||||
CREATE INDEX IF NOT EXISTS osm_route_member_member_network_ref_idx ON osm_route_member (member, network, ref);
|
||||
CREATE INDEX IF NOT EXISTS osm_route_member_member_network_ref_idx
|
||||
ON osm_route_member (member, COALESCE(network, ''), COALESCE(ref, ''));
|
||||
|
||||
-- Analyze created index
|
||||
ANALYZE osm_route_member;
|
||||
|
||||
@ -22,7 +22,7 @@ SELECT
|
||||
ST_Length(g) *
|
||||
COS(RADIANS(ST_Y(ST_Centroid(ST_Transform(g, 4326))))) *
|
||||
POW(2, zoom_level) / 20131560 > 0.02
|
||||
$$ LANGUAGE SQL IMMUTABLE LEAKPROOF
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
-- Determine whether a segment is long enough to have layer attributes
|
||||
@ -39,7 +39,24 @@ SELECT
|
||||
COS(RADIANS(ST_Y(ST_Centroid(ST_Transform(g, 4326))))) *
|
||||
POW(2, zoom_level) / 20131560 > 0.02
|
||||
THEN layer END
|
||||
$$ LANGUAGE SQL IMMUTABLE LEAKPROOF
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
-- Determine whether a segment is long enough to have an attribute
|
||||
CREATE OR REPLACE FUNCTION visible_text(g geometry, attr text, zoom_level integer)
|
||||
RETURNS text AS
|
||||
$$
|
||||
SELECT
|
||||
CASE WHEN
|
||||
-- Width of a tile in meters (111,842 is the length of one degree of latitude at the equator in meters)
|
||||
-- 111,842 * 180 / 2^zoom_level
|
||||
-- = 20131560 / POW(2, zoom_level)
|
||||
-- Drop brunnel if length of way < 2% of tile width (less than 3 pixels)
|
||||
ST_Length(g) *
|
||||
COS(RADIANS(ST_Y(ST_Centroid(ST_Transform(g, 4326))))) *
|
||||
POW(2, zoom_level) / 20131560 > 0.02
|
||||
THEN attr END
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
-- Instead of using relations to find out the road names we
|
||||
@ -49,7 +66,8 @@ $$ LANGUAGE SQL IMMUTABLE LEAKPROOF
|
||||
|
||||
-- etldoc: osm_highway_linestring -> osm_transportation_name_network
|
||||
-- etldoc: transportation_route_member_coalesced -> osm_transportation_name_network
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_name_network AS
|
||||
DROP TABLE IF EXISTS osm_transportation_name_network;
|
||||
CREATE TABLE osm_transportation_name_network AS
|
||||
SELECT
|
||||
geometry,
|
||||
osm_id,
|
||||
@ -84,12 +102,12 @@ FROM (
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN layer END AS layer,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN level END AS level,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN indoor END AS indoor,
|
||||
NULLIF(rm1.network, '') || '=' || COALESCE(rm1.ref, '') AS route_1,
|
||||
NULLIF(rm2.network, '') || '=' || COALESCE(rm2.ref, '') AS route_2,
|
||||
NULLIF(rm3.network, '') || '=' || COALESCE(rm3.ref, '') AS route_3,
|
||||
NULLIF(rm4.network, '') || '=' || COALESCE(rm4.ref, '') AS route_4,
|
||||
NULLIF(rm5.network, '') || '=' || COALESCE(rm5.ref, '') AS route_5,
|
||||
NULLIF(rm6.network, '') || '=' || COALESCE(rm6.ref, '') AS route_6,
|
||||
create_route_hstore(rm1.network, rm1.ref, rm1.name, rm1.colour, rm1.ref_colour) AS route_1,
|
||||
create_route_hstore(rm2.network, rm2.ref, rm2.name, rm2.colour, rm2.ref_colour) AS route_2,
|
||||
create_route_hstore(rm3.network, rm3.ref, rm3.name, rm3.colour, rm3.ref_colour) AS route_3,
|
||||
create_route_hstore(rm4.network, rm4.ref, rm4.name, rm4.colour, rm4.ref_colour) AS route_4,
|
||||
create_route_hstore(rm5.network, rm5.ref, rm5.name, rm5.colour, rm5.ref_colour) AS route_5,
|
||||
create_route_hstore(rm6.network, rm6.ref, rm6.name, rm6.colour, rm6.ref_colour) AS route_6,
|
||||
hl.z_order,
|
||||
LEAST(rm1.rank, rm2.rank, rm3.rank, rm4.rank, rm5.rank, rm6.rank) AS route_rank
|
||||
FROM osm_highway_linestring hl
|
||||
@ -126,6 +144,8 @@ CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z11(
|
||||
id SERIAL,
|
||||
osm_id bigint,
|
||||
source_ids bigint[],
|
||||
new_source_ids bigint[],
|
||||
old_source_ids bigint[],
|
||||
highway character varying,
|
||||
network character varying,
|
||||
construction character varying,
|
||||
@ -144,12 +164,23 @@ CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z11(
|
||||
layer integer
|
||||
);
|
||||
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z11 ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z11 ADD COLUMN IF NOT EXISTS new_source_ids BIGINT[];
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z11 ADD COLUMN IF NOT EXISTS old_source_ids BIGINT[];
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z11_n_source_ids_not_null_idx
|
||||
ON osm_transportation_merge_linestring_gen_z11 ((new_source_ids IS NOT NULL));
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z11_o_source_ids_not_null_idx
|
||||
ON osm_transportation_merge_linestring_gen_z11 ((old_source_ids IS NOT NULL));
|
||||
|
||||
-- Create osm_transportation_merge_linestring_gen_z10 as a copy of osm_transportation_merge_linestring_gen_z11 but
|
||||
-- drop the "source_ids" column. This can be done because z10 and z9 tables are only simplified and not merged,
|
||||
-- therefore relations to sources are direct via the id column.
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z10
|
||||
(LIKE osm_transportation_merge_linestring_gen_z11);
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z10 DROP COLUMN IF EXISTS source_ids;
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z10 DROP COLUMN IF EXISTS new_source_ids;
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z10 DROP COLUMN IF EXISTS old_source_ids;
|
||||
|
||||
-- Create osm_transportation_merge_linestring_gen_z9 as a copy of osm_transportation_merge_linestring_gen_z10
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z9
|
||||
@ -445,10 +476,12 @@ CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z9_geometry_i
|
||||
|
||||
-- etldoc: osm_transportation_merge_linestring_gen_z9 -> osm_transportation_merge_linestring_gen_z8
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z8(
|
||||
geometry geometry('LineString'),
|
||||
geometry geometry,
|
||||
id SERIAL,
|
||||
osm_id bigint,
|
||||
source_ids int[],
|
||||
new_source_ids bigint[],
|
||||
old_source_ids bigint[],
|
||||
highway character varying,
|
||||
network character varying,
|
||||
construction character varying,
|
||||
@ -459,12 +492,23 @@ CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z8(
|
||||
z_order integer
|
||||
);
|
||||
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z8 ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z8 ADD COLUMN IF NOT EXISTS new_source_ids bigint[];
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z8 ADD COLUMN IF NOT EXISTS old_source_ids bigint[];
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z8_n_source_ids_not_null_idx
|
||||
ON osm_transportation_merge_linestring_gen_z8 ((new_source_ids IS NOT NULL));
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z8_o_source_ids_not_null_idx
|
||||
ON osm_transportation_merge_linestring_gen_z8 ((old_source_ids IS NOT NULL));
|
||||
|
||||
-- Create osm_transportation_merge_linestring_gen_z7 as a copy of osm_transportation_merge_linestring_gen_z8 but
|
||||
-- drop the "source_ids" column. This can be done because z7 to z5 tables are only simplified and not merged,
|
||||
-- therefore relations to sources are direct via the id column.
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z7
|
||||
(LIKE osm_transportation_merge_linestring_gen_z8);
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z7 DROP COLUMN IF EXISTS source_ids;
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z7 DROP COLUMN IF EXISTS new_source_ids;
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z7 DROP COLUMN IF EXISTS old_source_ids;
|
||||
|
||||
-- Create osm_transportation_merge_linestring_gen_z6 as a copy of osm_transportation_merge_linestring_gen_z7
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z6
|
||||
@ -662,7 +706,50 @@ BEGIN
|
||||
|
||||
-- etldoc: osm_transportation_merge_linestring_gen_z8 -> osm_transportation_merge_linestring_gen_z7
|
||||
INSERT INTO osm_transportation_merge_linestring_gen_z7
|
||||
SELECT ST_Simplify(geometry, ZRes(9)) AS geometry,
|
||||
WITH roads_z8 AS (
|
||||
SELECT id,
|
||||
osm_id,
|
||||
ST_SnapToGrid(
|
||||
ST_Node(
|
||||
ST_Collect(
|
||||
ST_Simplify(geometry, ZRes(9))
|
||||
)
|
||||
), ZRes(9)
|
||||
) AS geometry,
|
||||
highway,
|
||||
NULLIF(network, '') as network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
z_order
|
||||
FROM osm_transportation_merge_linestring_gen_z8
|
||||
GROUP BY id, osm_id, highway, construction, network, is_bridge, is_tunnel, is_ford, expressway, z_order
|
||||
),
|
||||
roads_z8_merge AS (
|
||||
SELECT id,
|
||||
osm_id,
|
||||
ST_LineMerge(
|
||||
ST_Union(geometry)
|
||||
) AS geometry,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
z_order
|
||||
FROM roads_z8
|
||||
GROUP BY id, osm_id, highway, network, construction, is_bridge, is_tunnel, is_ford, expressway, z_order
|
||||
)
|
||||
|
||||
SELECT CASE
|
||||
WHEN ST_StartPoint(geometry) = ST_EndPoint(geometry)
|
||||
THEN ST_RemovePoint(geometry, ST_NPoints(geometry) - 1)
|
||||
ELSE geometry
|
||||
END AS geometry,
|
||||
id,
|
||||
osm_id,
|
||||
highway,
|
||||
@ -674,13 +761,13 @@ BEGIN
|
||||
visible_brunnel(geometry, is_ford, 8) AS is_ford,
|
||||
expressway,
|
||||
z_order
|
||||
FROM osm_transportation_merge_linestring_gen_z8
|
||||
FROM roads_z8_merge
|
||||
-- Current view: motorway/trunk/primary
|
||||
WHERE
|
||||
(full_update IS TRUE OR EXISTS(
|
||||
SELECT NULL FROM transportation.changes_z4_z5_z6_z7
|
||||
WHERE transportation.changes_z4_z5_z6_z7.is_old IS FALSE AND
|
||||
transportation.changes_z4_z5_z6_z7.id = osm_transportation_merge_linestring_gen_z8.id
|
||||
transportation.changes_z4_z5_z6_z7.id = roads_z8_merge.id
|
||||
)) AND
|
||||
(ST_Length(geometry) > 50)
|
||||
ON CONFLICT (id) DO UPDATE SET osm_id = excluded.osm_id, highway = excluded.highway, network = excluded.network,
|
||||
@ -803,7 +890,12 @@ BEGIN
|
||||
WHERE transportation.changes_z4_z5_z6_z7.is_old IS FALSE AND
|
||||
transportation.changes_z4_z5_z6_z7.id = osm_transportation_merge_linestring_gen_z5.id
|
||||
)) AND
|
||||
osm_national_network(network) AND
|
||||
-- All motorways without network (e.g. EU, Asia, South America)
|
||||
((highway = 'motorway' OR construction = 'motorway') AND (network is NULL or network = '')
|
||||
) OR
|
||||
-- All roads in network included in osm_national_network except gb-trunk and us-highway
|
||||
( (osm_national_network(network) AND network NOT IN ('gb-trunk', 'us-highway')
|
||||
)) AND
|
||||
-- Current view: national-importance motorways and trunks
|
||||
ST_Length(geometry) > 1000
|
||||
ON CONFLICT (id) DO UPDATE SET osm_id = excluded.osm_id, highway = excluded.highway, network = excluded.network,
|
||||
@ -857,6 +949,12 @@ CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z4_geometry_i
|
||||
-- osm_highway_linestring_gen_z11 -> osm_transportation_merge_linestring_gen_z11
|
||||
-- osm_transportation_merge_linestring_gen_z11 -> osm_transportation_merge_linestring_gen_z10
|
||||
-- osm_transportation_merge_linestring_gen_z11 -> osm_transportation_merge_linestring_gen_z9
|
||||
CREATE OR REPLACE AGGREGATE array_cat_agg(anycompatiblearray) (
|
||||
SFUNC=array_cat,
|
||||
STYPE=anycompatiblearray,
|
||||
INITCOND = '{}'
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS transportation.changes_z11
|
||||
(
|
||||
is_old boolean NULL,
|
||||
@ -958,7 +1056,8 @@ BEGIN
|
||||
-- Create a table containing all LineStrings which should be merged
|
||||
CREATE TEMPORARY TABLE linestrings_to_merge AS
|
||||
-- Add all Source-LineStrings affected by this update
|
||||
SELECT osm_highway_linestring_gen_z11.osm_id, NULL::INTEGER AS id, geometry, highway, network, construction,
|
||||
SELECT osm_highway_linestring_gen_z11.osm_id, NULL::INTEGER AS id, NULL::BIGINT[] AS source_ids,
|
||||
geometry, highway, network, construction,
|
||||
visible_brunnel(geometry, is_bridge, 11) AS is_bridge,
|
||||
visible_brunnel(geometry, is_tunnel, 11) AS is_tunnel,
|
||||
visible_brunnel(geometry, is_ford, 11) AS is_ford,
|
||||
@ -981,22 +1080,22 @@ BEGIN
|
||||
-- Drop temporary tables early to save resources
|
||||
DROP TABLE affected_merged_linestrings;
|
||||
|
||||
-- Create index on geometry column and analyze the created table to speed up subsequent queries
|
||||
CREATE INDEX ON linestrings_to_merge USING GIST (geometry);
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
|
||||
-- Add all Merged-LineStrings intersecting with Source-LineStrings affected by this update
|
||||
INSERT INTO linestrings_to_merge
|
||||
SELECT s.source_id AS osm_id, m.id,
|
||||
geometry, highway, network, construction,
|
||||
visible_brunnel(geometry, is_bridge, 11) AS is_bridge,
|
||||
visible_brunnel(geometry, is_tunnel, 11) AS is_tunnel,
|
||||
visible_brunnel(geometry, is_ford, 11) AS is_ford,
|
||||
expressway, bicycle, foot, horse, mtb_scale, sac_scale, access, toll,
|
||||
visible_layer(geometry, layer, 11) AS layer, z_order
|
||||
FROM osm_transportation_merge_linestring_gen_z11 m
|
||||
JOIN osm_transportation_merge_linestring_gen_z11_source_ids s ON (m.id = s.id)
|
||||
WHERE EXISTS(SELECT NULL FROM linestrings_to_merge WHERE ST_Intersects(linestrings_to_merge.geometry, m.geometry));
|
||||
SELECT NULL::BIGINT AS osm_id, m.id,
|
||||
ARRAY(
|
||||
SELECT s.source_id FROM osm_transportation_merge_linestring_gen_z11_source_ids s WHERE s.id = m.id
|
||||
)::BIGINT[] AS source_ids, m.geometry, m.highway, m.network, m.construction,
|
||||
visible_brunnel(m.geometry, m.is_bridge, 11) AS is_bridge,
|
||||
visible_brunnel(m.geometry, m.is_tunnel, 11) AS is_tunnel,
|
||||
visible_brunnel(m.geometry, m.is_ford, 11) AS is_ford,
|
||||
m.expressway, m.bicycle, m.foot, m.horse, m.mtb_scale, m.sac_scale, m.access, m.toll,
|
||||
visible_layer(m.geometry, m.layer, 11) AS layer, m.z_order
|
||||
FROM linestrings_to_merge
|
||||
JOIN osm_transportation_merge_linestring_gen_z11 m ON (ST_Intersects(linestrings_to_merge.geometry, m.geometry));
|
||||
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
@ -1039,16 +1138,12 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID column to store relations before they have been
|
||||
-- intersected
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z11 ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
INSERT INTO osm_transportation_merge_linestring_gen_z11(geometry, source_ids, highway, network, construction,
|
||||
is_bridge, is_tunnel, is_ford, expressway, z_order,
|
||||
bicycle, foot, horse, mtb_scale, sac_scale, access,
|
||||
toll, layer)
|
||||
INSERT INTO osm_transportation_merge_linestring_gen_z11(geometry, new_source_ids, old_source_ids, highway,
|
||||
network, construction, is_bridge, is_tunnel, is_ford,
|
||||
expressway, z_order, bicycle, foot, horse, mtb_scale,
|
||||
sac_scale, access, toll, layer)
|
||||
SELECT (ST_Dump(ST_LineMerge(ST_Union(geometry)))).geom AS geometry,
|
||||
-- We use St_Union instead of St_Collect to ensure no overlapping points exist within the geometries to
|
||||
-- merge. https://postgis.net/docs/ST_Union.html
|
||||
@ -1057,7 +1152,8 @@ BEGIN
|
||||
-- https://postgis.net/docs/ST_LineMerge.html
|
||||
-- In order to not end up with a mixture of LineStrings and MultiLineStrings we dump eventual
|
||||
-- MultiLineStrings via ST_Dump. https://postgis.net/docs/ST_Dump.html
|
||||
array_agg(osm_id) AS source_ids,
|
||||
coalesce( array_agg(osm_id) FILTER (WHERE osm_id IS NOT NULL), '{}' )::BIGINT[] AS new_source_ids,
|
||||
array_cat_agg(source_ids)::BIGINT[] AS old_source_ids,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
@ -1077,7 +1173,7 @@ BEGIN
|
||||
FROM clustered_linestrings_to_merge
|
||||
GROUP BY cluster_group, cluster, highway, network, construction, is_bridge, is_tunnel, is_ford, expressway,
|
||||
bicycle, foot, horse, mtb_scale, sac_scale, access, toll, layer
|
||||
RETURNING id, source_ids, geometry
|
||||
RETURNING id, new_source_ids, old_source_ids, geometry
|
||||
)
|
||||
-- Store OSM-IDs of Source-LineStrings by intersecting Merged-LineStrings with their sources.
|
||||
-- This is required because ST_LineMerge only merges across singular intersections and groups its output into a
|
||||
@ -1085,8 +1181,14 @@ BEGIN
|
||||
INSERT INTO osm_transportation_merge_linestring_gen_z11_source_ids (id, source_id)
|
||||
SELECT m.id, source_id
|
||||
FROM (
|
||||
SELECT id, unnest(source_ids) AS source_id, geometry
|
||||
SELECT id, source_id, geometry
|
||||
FROM inserted_linestrings
|
||||
CROSS JOIN LATERAL (
|
||||
SELECT DISTINCT all_source_ids.source_id
|
||||
FROM unnest(
|
||||
array_cat(inserted_linestrings.new_source_ids, inserted_linestrings.old_source_ids)
|
||||
) AS all_source_ids(source_id)
|
||||
) source_ids
|
||||
) m
|
||||
JOIN osm_highway_linestring_gen_z11 s ON (m.source_id = s.osm_id)
|
||||
WHERE ST_Intersects(s.geometry, m.geometry)
|
||||
@ -1095,8 +1197,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID column
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z11 DROP COLUMN IF EXISTS source_ids;
|
||||
-- Restore temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
UPDATE osm_transportation_merge_linestring_gen_z11 SET new_source_ids = NULL WHERE new_source_ids IS NOT NULL;
|
||||
UPDATE osm_transportation_merge_linestring_gen_z11 SET old_source_ids = NULL WHERE old_source_ids IS NOT NULL;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM transportation.changes_z11;
|
||||
@ -1246,7 +1349,7 @@ BEGIN
|
||||
-- Create a table containing all LineStrings which should be merged
|
||||
CREATE TEMPORARY TABLE linestrings_to_merge AS
|
||||
-- Add all Source-LineStrings affected by this update
|
||||
SELECT id AS source_id, NULL::int AS id, geometry, highway, network, construction,
|
||||
SELECT id AS source_id, NULL::INT AS id, NULL::INT[] AS source_ids, geometry, highway, network, construction,
|
||||
visible_brunnel(geometry, is_bridge, 9) AS is_bridge,
|
||||
visible_brunnel(geometry, is_tunnel, 9) AS is_tunnel,
|
||||
visible_brunnel(geometry, is_ford, 9) AS is_ford, expressway, z_order
|
||||
@ -1260,31 +1363,32 @@ BEGIN
|
||||
ORDER BY source_id
|
||||
) affected_source_linestrings
|
||||
JOIN osm_transportation_merge_linestring_gen_z9 ON (
|
||||
affected_source_linestrings.source_id = osm_transportation_merge_linestring_gen_z9.id AND
|
||||
(
|
||||
affected_source_linestrings.source_id = osm_transportation_merge_linestring_gen_z9.id
|
||||
)
|
||||
WHERE (
|
||||
highway IN ('motorway', 'trunk', 'primary') OR
|
||||
construction IN ('motorway', 'trunk', 'primary')
|
||||
) AND
|
||||
ST_IsValid(geometry) AND
|
||||
access IS NULL
|
||||
);
|
||||
access IS NULL;
|
||||
|
||||
-- Drop temporary tables early to save resources
|
||||
DROP TABLE affected_merged_linestrings;
|
||||
|
||||
-- Create index on geometry column and analyze the created table to speed up subsequent queries
|
||||
CREATE INDEX ON linestrings_to_merge USING GIST (geometry);
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
|
||||
-- Add all Merged-LineStrings intersecting with Source-LineStrings affected by this update
|
||||
INSERT INTO linestrings_to_merge
|
||||
SELECT s.source_id, m.id, geometry, highway, network, construction,
|
||||
visible_brunnel(geometry, is_bridge, 9) AS is_bridge,
|
||||
visible_brunnel(geometry, is_tunnel, 9) AS is_tunnel,
|
||||
visible_brunnel(geometry, is_ford, 9) AS is_ford, expressway, z_order
|
||||
FROM osm_transportation_merge_linestring_gen_z8 m
|
||||
JOIN osm_transportation_merge_linestring_gen_z8_source_ids s ON (m.id = s.id)
|
||||
WHERE EXISTS(SELECT NULL FROM linestrings_to_merge WHERE ST_Intersects(linestrings_to_merge.geometry, m.geometry));
|
||||
SELECT NULL::INT AS source_id, m.id,
|
||||
ARRAY(
|
||||
SELECT s.source_id FROM osm_transportation_merge_linestring_gen_z8_source_ids s WHERE s.id = m.id
|
||||
)::INT[] AS source_ids, m.geometry, m.highway, m.network, m.construction,
|
||||
visible_brunnel(m.geometry, m.is_bridge, 9) AS is_bridge,
|
||||
visible_brunnel(m.geometry, m.is_tunnel, 9) AS is_tunnel,
|
||||
visible_brunnel(m.geometry, m.is_ford, 9) AS is_ford, m.expressway, m.z_order
|
||||
FROM linestrings_to_merge
|
||||
JOIN osm_transportation_merge_linestring_gen_z8 m ON (ST_Intersects(linestrings_to_merge.geometry, m.geometry));
|
||||
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
@ -1325,14 +1429,13 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID column to store relations before they have been
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID columns to store relations before they have been
|
||||
-- intersected
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z8 ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
INSERT INTO osm_transportation_merge_linestring_gen_z8(geometry, source_ids, highway, network, construction,
|
||||
is_bridge, is_tunnel, is_ford, expressway, z_order)
|
||||
INSERT INTO osm_transportation_merge_linestring_gen_z8(geometry, new_source_ids, old_source_ids, highway,
|
||||
network, construction, is_bridge, is_tunnel, is_ford,
|
||||
expressway, z_order)
|
||||
SELECT (ST_Dump(ST_Simplify(ST_LineMerge(ST_Union(geometry)), ZRes(10)))).geom AS geometry,
|
||||
-- We use St_Union instead of St_Collect to ensure no overlapping points exist within the geometries to
|
||||
-- merge. https://postgis.net/docs/ST_Union.html
|
||||
@ -1341,7 +1444,8 @@ BEGIN
|
||||
-- https://postgis.net/docs/ST_LineMerge.html
|
||||
-- In order to not end up with a mixture of LineStrings and MultiLineStrings we dump eventual
|
||||
-- MultiLineStrings via ST_Dump. https://postgis.net/docs/ST_Dump.html
|
||||
array_agg(source_id) as source_ids,
|
||||
coalesce( array_agg(source_id) FILTER (WHERE source_id IS NOT NULL), '{}' )::INT[] AS new_source_ids,
|
||||
array_cat_agg(source_ids)::INT[] as old_source_ids,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
@ -1352,7 +1456,7 @@ BEGIN
|
||||
min(z_order) as z_order
|
||||
FROM clustered_linestrings_to_merge
|
||||
GROUP BY cluster_group, cluster, highway, network, construction, is_bridge, is_tunnel, is_ford, expressway
|
||||
RETURNING id, source_ids, geometry
|
||||
RETURNING id, new_source_ids, old_source_ids, geometry
|
||||
)
|
||||
-- Store OSM-IDs of Source-LineStrings by intersecting Merged-LineStrings with their sources. This required because
|
||||
-- ST_LineMerge only merges across singular intersections and groups its output into a MultiLineString if
|
||||
@ -1360,8 +1464,14 @@ BEGIN
|
||||
INSERT INTO osm_transportation_merge_linestring_gen_z8_source_ids (id, source_id)
|
||||
SELECT m.id, m.source_id
|
||||
FROM (
|
||||
SELECT id, unnest(source_ids) AS source_id, geometry
|
||||
SELECT id, source_id, geometry
|
||||
FROM inserted_linestrings
|
||||
CROSS JOIN LATERAL (
|
||||
SELECT DISTINCT all_source_ids.source_id
|
||||
FROM unnest(
|
||||
array_cat(inserted_linestrings.new_source_ids, inserted_linestrings.old_source_ids)
|
||||
) AS all_source_ids(source_id)
|
||||
) source_ids
|
||||
) m
|
||||
JOIN osm_transportation_merge_linestring_gen_z9 s ON (m.source_id = s.id)
|
||||
WHERE ST_Intersects(s.geometry, m.geometry)
|
||||
@ -1370,9 +1480,10 @@ BEGIN
|
||||
-- Cleanup
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID column
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z8 DROP COLUMN IF EXISTS source_ids;
|
||||
-- Restore temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
|
||||
UPDATE osm_transportation_merge_linestring_gen_z8 SET new_source_ids = NULL WHERE new_source_ids IS NOT NULL;
|
||||
UPDATE osm_transportation_merge_linestring_gen_z8 SET old_source_ids = NULL WHERE old_source_ids IS NOT NULL;
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM transportation.changes_z9;
|
||||
-- noinspection SqlWithoutWhere
|
||||
|
||||
@ -1,52 +1,46 @@
|
||||
CREATE OR REPLACE FUNCTION highway_to_val(hwy_class varchar)
|
||||
RETURNS int
|
||||
IMMUTABLE
|
||||
LANGUAGE plpgsql
|
||||
LANGUAGE sql
|
||||
AS $$
|
||||
BEGIN
|
||||
CASE hwy_class
|
||||
WHEN 'motorway' THEN RETURN 6;
|
||||
WHEN 'trunk' THEN RETURN 5;
|
||||
WHEN 'primary' THEN RETURN 4;
|
||||
WHEN 'secondary' THEN RETURN 3;
|
||||
WHEN 'tertiary' THEN RETURN 2;
|
||||
WHEN 'unclassified' THEN RETURN 1;
|
||||
else RETURN 0;
|
||||
END CASE;
|
||||
END;
|
||||
SELECT CASE hwy_class
|
||||
WHEN 'motorway' THEN 6
|
||||
WHEN 'trunk' THEN 5
|
||||
WHEN 'primary' THEN 4
|
||||
WHEN 'secondary' THEN 3
|
||||
WHEN 'tertiary' THEN 2
|
||||
WHEN 'unclassified' THEN 1
|
||||
ELSE 0
|
||||
END;
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE FUNCTION val_to_highway(hwy_val int)
|
||||
RETURNS varchar
|
||||
IMMUTABLE
|
||||
LANGUAGE plpgsql
|
||||
LANGUAGE sql
|
||||
AS $$
|
||||
BEGIN
|
||||
CASE hwy_val
|
||||
WHEN 6 THEN RETURN 'motorway';
|
||||
WHEN 5 THEN RETURN 'trunk';
|
||||
WHEN 4 THEN RETURN 'primary';
|
||||
WHEN 3 THEN RETURN 'secondary';
|
||||
WHEN 2 THEN RETURN 'tertiary';
|
||||
WHEN 1 THEN RETURN 'unclassified';
|
||||
else RETURN null;
|
||||
END CASE;
|
||||
END;
|
||||
SELECT CASE hwy_val
|
||||
WHEN 6 THEN 'motorway'
|
||||
WHEN 5 THEN 'trunk'
|
||||
WHEN 4 THEN 'primary'
|
||||
WHEN 3 THEN 'secondary'
|
||||
WHEN 2 THEN 'tertiary'
|
||||
WHEN 1 THEN 'unclassified'
|
||||
ELSE null
|
||||
END;
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE FUNCTION highest_hwy_sfunc(agg_state varchar, hwy_class varchar)
|
||||
RETURNS varchar
|
||||
IMMUTABLE
|
||||
LANGUAGE plpgsql
|
||||
LANGUAGE sql
|
||||
AS $$
|
||||
BEGIN
|
||||
RETURN val_to_highway(
|
||||
SELECT val_to_highway(
|
||||
GREATEST(
|
||||
highway_to_val(agg_state),
|
||||
highway_to_val(hwy_class)
|
||||
)
|
||||
);
|
||||
END;
|
||||
$$;
|
||||
|
||||
DROP AGGREGATE IF EXISTS highest_highway (varchar);
|
||||
|
||||
@ -12,12 +12,30 @@ CREATE OR REPLACE FUNCTION layer_transportation_name(bbox geometry, zoom_level i
|
||||
ref text,
|
||||
ref_length int,
|
||||
network text,
|
||||
route_1 text,
|
||||
route_2 text,
|
||||
route_3 text,
|
||||
route_4 text,
|
||||
route_5 text,
|
||||
route_6 text,
|
||||
route_1_network text,
|
||||
route_1_ref text,
|
||||
route_1_name text,
|
||||
route_1_colour text,
|
||||
route_2_network text,
|
||||
route_2_ref text,
|
||||
route_2_name text,
|
||||
route_2_colour text,
|
||||
route_3_network text,
|
||||
route_3_ref text,
|
||||
route_3_name text,
|
||||
route_3_colour text,
|
||||
route_4_network text,
|
||||
route_4_ref text,
|
||||
route_4_name text,
|
||||
route_4_colour text,
|
||||
route_5_network text,
|
||||
route_5_ref text,
|
||||
route_5_name text,
|
||||
route_5_colour text,
|
||||
route_6_network text,
|
||||
route_6_ref text,
|
||||
route_6_name text,
|
||||
route_6_colour text,
|
||||
class text,
|
||||
subclass text,
|
||||
brunnel text,
|
||||
@ -40,14 +58,42 @@ SELECT geometry,
|
||||
WHEN length(coalesce(ref, '')) > 0
|
||||
THEN 'road'
|
||||
END AS network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
route_1->'network' AS route_1_network,
|
||||
route_1->'ref' AS route_1_ref,
|
||||
route_1->'name' AS route_1_name,
|
||||
route_1->'colour' AS route_1_colour,
|
||||
|
||||
route_2->'network' AS route_2_network,
|
||||
route_2->'ref' AS route_2_ref,
|
||||
route_2->'name' AS route_2_name,
|
||||
route_2->'colour' AS route_2_colour,
|
||||
|
||||
route_3->'network' AS route_3_network,
|
||||
route_3->'ref' AS route_3_ref,
|
||||
route_3->'name' AS route_3_name,
|
||||
route_3->'colour' AS route_3_colour,
|
||||
|
||||
route_4->'network' AS route_4_network,
|
||||
route_4->'ref' AS route_4_ref,
|
||||
route_4->'name' AS route_4_name,
|
||||
route_4->'colour' AS route_4_colour,
|
||||
|
||||
route_5->'network' AS route_5_network,
|
||||
route_5->'ref' AS route_5_ref,
|
||||
route_5->'name' AS route_5_name,
|
||||
route_5->'colour' AS route_5_colour,
|
||||
|
||||
route_6->'network' AS route_6_network,
|
||||
route_6->'ref' AS route_6_ref,
|
||||
route_6->'name' AS route_6_name,
|
||||
route_6->'colour' AS route_6_colour,
|
||||
highway_class(highway, '', subclass) AS class,
|
||||
CASE
|
||||
WHEN highway IS NOT NULL AND highway_class(highway, '', subclass) = 'path'
|
||||
THEN highway
|
||||
ELSE subclass
|
||||
END AS subclass,
|
||||
brunnel,
|
||||
NULLIF(brunnel, '') AS brunnel,
|
||||
NULLIF(layer, 0) AS layer,
|
||||
"level",
|
||||
CASE WHEN indoor = TRUE THEN 1 END AS indoor
|
||||
@ -94,7 +140,7 @@ FROM (
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor
|
||||
FROM osm_transportation_name_linestring_gen3
|
||||
WHERE zoom_level = 7
|
||||
WHERE ST_Length(geometry) > 20000 AND zoom_level = 7
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen2 -> layer_transportation_name:z8
|
||||
@ -116,7 +162,7 @@ FROM (
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor
|
||||
FROM osm_transportation_name_linestring_gen2
|
||||
WHERE zoom_level = 8
|
||||
WHERE ST_Length(geometry) > 14000 AND zoom_level = 8
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z9
|
||||
@ -140,7 +186,7 @@ FROM (
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor
|
||||
FROM osm_transportation_name_linestring_gen1
|
||||
WHERE zoom_level BETWEEN 9 AND 11
|
||||
WHERE ST_Length(geometry) > 8000 / POWER(2, zoom_level - 9) AND zoom_level BETWEEN 9 AND 11
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z12
|
||||
@ -158,7 +204,7 @@ FROM (
|
||||
indoor
|
||||
FROM osm_transportation_name_linestring
|
||||
WHERE zoom_level = 12
|
||||
AND LineLabel(zoom_level, COALESCE(tags->'name', ref), geometry)
|
||||
AND LineLabel(zoom_level, COALESCE(ref, tags->'name'), geometry)
|
||||
AND NOT highway_is_link(highway)
|
||||
AND
|
||||
CASE WHEN highway_class(highway, NULL::text, NULL::text) NOT IN ('path', 'minor') THEN TRUE
|
||||
@ -182,7 +228,7 @@ FROM (
|
||||
indoor
|
||||
FROM osm_transportation_name_linestring
|
||||
WHERE zoom_level = 13
|
||||
AND LineLabel(zoom_level, COALESCE(tags->'name', ref), geometry)
|
||||
AND LineLabel(zoom_level, COALESCE(ref, tags->'name'), geometry)
|
||||
AND
|
||||
CASE WHEN highway <> 'path' THEN TRUE
|
||||
WHEN highway = 'path' AND (
|
||||
@ -225,12 +271,12 @@ FROM (
|
||||
'junction'::text AS subclass,
|
||||
NULL AS brunnel,
|
||||
NULL AS network,
|
||||
NULL::text AS route_1,
|
||||
NULL::text AS route_2,
|
||||
NULL::text AS route_3,
|
||||
NULL::text AS route_4,
|
||||
NULL::text AS route_5,
|
||||
NULL::text AS route_6,
|
||||
NULL::hstore AS route_1,
|
||||
NULL::hstore AS route_2,
|
||||
NULL::hstore AS route_3,
|
||||
NULL::hstore AS route_4,
|
||||
NULL::hstore AS route_5,
|
||||
NULL::hstore AS route_6,
|
||||
z_order,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
||||
@ -13,8 +13,8 @@ layer:
|
||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Highways#Names_and_references) value of the highway.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
ref: The OSM [`ref`](http://wiki.openstreetmap.org/wiki/Key:ref) tag of the motorway or its network.
|
||||
ref_length: Length of the `ref` field. Useful for having a shield icon as background for labeling motorways.
|
||||
network:
|
||||
@ -101,16 +101,34 @@ layer:
|
||||
value of [`indoor`](http://wiki.openstreetmap.org/wiki/Key:indoor) tag.
|
||||
values:
|
||||
- 1
|
||||
route_1: 1st route concurrency.
|
||||
route_2: 2nd route concurrency.
|
||||
route_3: 3rd route concurrency.
|
||||
route_4: 4th route concurrency.
|
||||
route_5: 5th route concurrency.
|
||||
route_6: 6th route concurrency.
|
||||
route_1_network: 1st route concurrency network.
|
||||
route_1_ref: 1st route concurrency ref.
|
||||
route_1_name: 1st route concurrency name.
|
||||
route_1_colour: 1st route concurrency colour.
|
||||
route_2_network: 2nd route concurrency network.
|
||||
route_2_ref: 2nd route concurrency ref.
|
||||
route_2_name: 2nd route concurrency name.
|
||||
route_2_colour: 2nd route concurrency colour.
|
||||
route_3_network: 3rd route concurrency network.
|
||||
route_3_ref: 3rd route concurrency ref.
|
||||
route_3_name: 3rd route concurrency name.
|
||||
route_3_colour: 3rd route concurrency colour.
|
||||
route_4_network: 4th route concurrency network.
|
||||
route_4_ref: 4th route concurrency ref.
|
||||
route_4_name: 4th route concurrency name.
|
||||
route_4_colour: 4th route concurrency colour.
|
||||
route_5_network: 5th route concurrency network.
|
||||
route_5_ref: 5th route concurrency ref.
|
||||
route_5_name: 5th route concurrency name.
|
||||
route_5_colour: 5th route concurrency colour.
|
||||
route_6_network: 6th route concurrency network.
|
||||
route_6_ref: 6th route concurrency ref.
|
||||
route_6_name: 6th route concurrency name.
|
||||
route_6_colour: 6th route concurrency colour.
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
srid: 900913
|
||||
query: (SELECT geometry, name, name_en, name_de, {name_languages}, ref, ref_length, network::text, class::text, subclass, brunnel, layer, level, indoor, route_1, route_2, route_3, route_4, route_5, route_6 FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
|
||||
query: (SELECT geometry, name, name_en, name_de, {name_languages}, ref, ref_length, network::text, class::text, subclass, brunnel, layer, level, indoor, route_1_network, route_1_ref, route_1_name, route_1_colour, route_2_network, route_2_ref, route_2_name, route_2_colour, route_3_network, route_3_ref, route_3_name, route_3_colour, route_4_network, route_4_ref, route_4_name, route_4_colour, route_5_network, route_5_ref, route_5_name, route_5_colour, route_6_network, route_6_ref, route_6_name, route_6_colour FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./highway_classification.sql
|
||||
- ./update_transportation_name.sql
|
||||
|
||||
@ -41,6 +41,8 @@ CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring(
|
||||
source integer,
|
||||
geometry geometry('LineString'),
|
||||
source_ids bigint[],
|
||||
new_source_ids bigint[],
|
||||
old_source_ids bigint[],
|
||||
tags hstore,
|
||||
ref text,
|
||||
highway varchar,
|
||||
@ -51,16 +53,27 @@ CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring(
|
||||
layer integer,
|
||||
indoor boolean,
|
||||
network route_network_type,
|
||||
route_1 text,
|
||||
route_2 text,
|
||||
route_3 text,
|
||||
route_4 text,
|
||||
route_5 text,
|
||||
route_6 text,
|
||||
route_1 hstore,
|
||||
route_2 hstore,
|
||||
route_3 hstore,
|
||||
route_4 hstore,
|
||||
route_5 hstore,
|
||||
route_6 hstore,
|
||||
z_order integer,
|
||||
route_rank integer
|
||||
);
|
||||
|
||||
ALTER TABLE osm_transportation_name_linestring ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID columns to store relations before they have been
|
||||
-- intersected.
|
||||
ALTER TABLE osm_transportation_name_linestring ADD COLUMN IF NOT EXISTS new_source_ids BIGINT[];
|
||||
ALTER TABLE osm_transportation_name_linestring ADD COLUMN IF NOT EXISTS old_source_ids BIGINT[];
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_n_source_ids_not_null_idx
|
||||
ON osm_transportation_name_linestring ((new_source_ids IS NOT NULL));
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_o_source_ids_not_null_idx
|
||||
ON osm_transportation_name_linestring ((old_source_ids IS NOT NULL));
|
||||
|
||||
-- Create OneToMany-Relation-Table storing relations of a Merged-LineString in table
|
||||
-- osm_transportation_name_linestring to Source-LineStrings from tables osm_transportation_name_network,
|
||||
-- osm_shipway_linestring and osm_aerialway_linestring
|
||||
@ -168,12 +181,12 @@ FROM (
|
||||
layer,
|
||||
NULL AS indoor,
|
||||
NULL AS network_type,
|
||||
NULL AS route_1,
|
||||
NULL AS route_2,
|
||||
NULL AS route_3,
|
||||
NULL AS route_4,
|
||||
NULL AS route_5,
|
||||
NULL AS route_6,
|
||||
NULL::hstore AS route_1,
|
||||
NULL::hstore AS route_2,
|
||||
NULL::hstore AS route_3,
|
||||
NULL::hstore AS route_4,
|
||||
NULL::hstore AS route_5,
|
||||
NULL::hstore AS route_6,
|
||||
min(z_order) AS z_order,
|
||||
NULL::int AS route_rank
|
||||
FROM (
|
||||
@ -226,12 +239,12 @@ FROM (
|
||||
layer,
|
||||
NULL AS indoor,
|
||||
NULL AS network_type,
|
||||
NULL AS route_1,
|
||||
NULL AS route_2,
|
||||
NULL AS route_3,
|
||||
NULL AS route_4,
|
||||
NULL AS route_5,
|
||||
NULL AS route_6,
|
||||
NULL::hstore AS route_1,
|
||||
NULL::hstore AS route_2,
|
||||
NULL::hstore AS route_3,
|
||||
NULL::hstore AS route_4,
|
||||
NULL::hstore AS route_5,
|
||||
NULL::hstore AS route_6,
|
||||
min(z_order) AS z_order,
|
||||
NULL::int AS route_rank
|
||||
FROM (
|
||||
@ -267,19 +280,19 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx
|
||||
-- Create table for simplified LineStrings
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen1 (
|
||||
id integer,
|
||||
geometry geometry('LineString'),
|
||||
geometry geometry,
|
||||
tags hstore,
|
||||
ref text,
|
||||
highway varchar,
|
||||
subclass text,
|
||||
brunnel text,
|
||||
network route_network_type,
|
||||
route_1 text,
|
||||
route_2 text,
|
||||
route_3 text,
|
||||
route_4 text,
|
||||
route_5 text,
|
||||
route_6 text,
|
||||
route_1 hstore,
|
||||
route_2 hstore,
|
||||
route_3 hstore,
|
||||
route_4 hstore,
|
||||
route_5 hstore,
|
||||
route_6 hstore,
|
||||
z_order integer
|
||||
);
|
||||
|
||||
@ -424,25 +437,35 @@ BEGIN
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1
|
||||
INSERT INTO osm_transportation_name_linestring_gen1 (id, geometry, tags, ref, highway, subclass, brunnel, network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6, z_order)
|
||||
SELECT id, ST_Simplify(geometry, 50) AS geometry, tags, ref, highway, subclass, brunnel, network, route_1, route_2,
|
||||
route_3, route_4, route_5, route_6, z_order
|
||||
route_1, route_2, route_3, route_4, route_5, route_6)
|
||||
SELECT MIN(id) as id,
|
||||
ST_Simplify(ST_LineMerge(ST_Collect(geometry)), 50) AS geometry,
|
||||
tags, ref, highway, subclass, brunnel, network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6
|
||||
FROM (
|
||||
SELECT id,
|
||||
geometry,
|
||||
tags, ref, highway, subclass,
|
||||
visible_text(geometry, brunnel, 9) AS brunnel,
|
||||
network, route_1, route_2, route_3, route_4, route_5, route_6
|
||||
FROM osm_transportation_name_linestring
|
||||
) osm_transportation_name_linestring_gen1_pre_merge
|
||||
WHERE (
|
||||
full_update IS TRUE OR EXISTS (
|
||||
SELECT NULL
|
||||
FROM transportation_name.name_changes_gen
|
||||
WHERE transportation_name.name_changes_gen.is_old IS FALSE AND
|
||||
transportation_name.name_changes_gen.id = osm_transportation_name_linestring.id
|
||||
transportation_name.name_changes_gen.id = osm_transportation_name_linestring_gen1_pre_merge.id
|
||||
)
|
||||
) AND (
|
||||
(highway IN ('motorway', 'trunk') OR highway = 'construction' AND subclass IN ('motorway', 'trunk')) AND
|
||||
ST_Length(geometry) > 8000
|
||||
) ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, tags = excluded.tags, ref = excluded.ref,
|
||||
(highway IN ('motorway', 'trunk') OR highway = 'construction' AND subclass IN ('motorway', 'trunk'))
|
||||
)
|
||||
GROUP BY tags, ref, highway, subclass, brunnel, network, route_1, route_2, route_3, route_4, route_5, route_6
|
||||
ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, tags = excluded.tags, ref = excluded.ref,
|
||||
highway = excluded.highway, subclass = excluded.subclass,
|
||||
brunnel = excluded.brunnel, network = excluded.network, route_1 = excluded.route_1,
|
||||
route_2 = excluded.route_2, route_3 = excluded.route_3, route_4 = excluded.route_4,
|
||||
route_5 = excluded.route_5, route_6 = excluded.route_6, z_order = excluded.z_order;
|
||||
route_5 = excluded.route_5, route_6 = excluded.route_6;
|
||||
|
||||
-- Analyze source table
|
||||
ANALYZE osm_transportation_name_linestring_gen1;
|
||||
@ -457,25 +480,35 @@ BEGIN
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2
|
||||
INSERT INTO osm_transportation_name_linestring_gen2 (id, geometry, tags, ref, highway, subclass, brunnel, network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6, z_order)
|
||||
SELECT id, ST_Simplify(geometry, 120) AS geometry, tags, ref, highway, subclass, brunnel, network, route_1, route_2,
|
||||
route_3, route_4, route_5, route_6, z_order
|
||||
route_1, route_2, route_3, route_4, route_5, route_6)
|
||||
SELECT MIN(id) as id,
|
||||
ST_Simplify(ST_LineMerge(ST_Collect(geometry)), 120) AS geometry,
|
||||
tags, ref, highway, subclass, brunnel, network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6
|
||||
FROM (
|
||||
SELECT id,
|
||||
(ST_Dump(geometry)).geom AS geometry,
|
||||
tags, ref, highway, subclass,
|
||||
visible_text(geometry, brunnel, 8) AS brunnel,
|
||||
network, route_1, route_2, route_3, route_4, route_5, route_6
|
||||
FROM osm_transportation_name_linestring_gen1
|
||||
) osm_transportation_name_linestring_gen2_pre_merge
|
||||
WHERE (
|
||||
full_update IS TRUE OR EXISTS (
|
||||
SELECT NULL
|
||||
FROM transportation_name.name_changes_gen
|
||||
WHERE transportation_name.name_changes_gen.is_old IS FALSE AND
|
||||
transportation_name.name_changes_gen.id = osm_transportation_name_linestring_gen1.id
|
||||
transportation_name.name_changes_gen.id = osm_transportation_name_linestring_gen2_pre_merge.id
|
||||
)
|
||||
) AND (
|
||||
(highway IN ('motorway', 'trunk') OR highway = 'construction' AND subclass IN ('motorway', 'trunk')) AND
|
||||
ST_Length(geometry) > 14000
|
||||
) ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, tags = excluded.tags, ref = excluded.ref,
|
||||
(highway IN ('motorway', 'trunk') OR highway = 'construction' AND subclass IN ('motorway', 'trunk'))
|
||||
)
|
||||
GROUP BY tags, ref, highway, subclass, brunnel, network, route_1, route_2, route_3, route_4, route_5, route_6
|
||||
ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, tags = excluded.tags, ref = excluded.ref,
|
||||
highway = excluded.highway, subclass = excluded.subclass,
|
||||
brunnel = excluded.brunnel, network = excluded.network, route_1 = excluded.route_1,
|
||||
route_2 = excluded.route_2, route_3 = excluded.route_3, route_4 = excluded.route_4,
|
||||
route_5 = excluded.route_5, route_6 = excluded.route_6, z_order = excluded.z_order;
|
||||
route_5 = excluded.route_5, route_6 = excluded.route_6;
|
||||
|
||||
-- Analyze source table
|
||||
ANALYZE osm_transportation_name_linestring_gen2;
|
||||
@ -490,25 +523,35 @@ BEGIN
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3
|
||||
INSERT INTO osm_transportation_name_linestring_gen3 (id, geometry, tags, ref, highway, subclass, brunnel, network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6, z_order)
|
||||
SELECT id, ST_Simplify(geometry, 200) AS geometry, tags, ref, highway, subclass, brunnel, network, route_1, route_2,
|
||||
route_3, route_4, route_5, route_6, z_order
|
||||
route_1, route_2, route_3, route_4, route_5, route_6)
|
||||
SELECT MIN(id) as id,
|
||||
ST_Simplify(ST_LineMerge(ST_Collect(geometry)), 200) AS geometry,
|
||||
tags, ref, highway, subclass, brunnel, network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6
|
||||
FROM (
|
||||
SELECT id,
|
||||
(ST_Dump(geometry)).geom AS geometry,
|
||||
tags, ref, highway, subclass,
|
||||
visible_text(geometry, brunnel, 7) AS brunnel,
|
||||
network, route_1, route_2, route_3, route_4, route_5, route_6
|
||||
FROM osm_transportation_name_linestring_gen2
|
||||
) osm_transportation_name_linestring_gen3_pre_merge
|
||||
WHERE (
|
||||
full_update IS TRUE OR EXISTS (
|
||||
SELECT NULL
|
||||
FROM transportation_name.name_changes_gen
|
||||
WHERE transportation_name.name_changes_gen.is_old IS FALSE AND
|
||||
transportation_name.name_changes_gen.id = osm_transportation_name_linestring_gen2.id
|
||||
transportation_name.name_changes_gen.id = osm_transportation_name_linestring_gen3_pre_merge.id
|
||||
)
|
||||
) AND (
|
||||
(highway = 'motorway' OR highway = 'construction' AND subclass = 'motorway') AND
|
||||
ST_Length(geometry) > 20000
|
||||
) ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, tags = excluded.tags, ref = excluded.ref,
|
||||
(highway = 'motorway' OR highway = 'construction' AND subclass = 'motorway')
|
||||
)
|
||||
GROUP BY tags, ref, highway, subclass, brunnel, network, route_1, route_2, route_3, route_4, route_5, route_6
|
||||
ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, tags = excluded.tags, ref = excluded.ref,
|
||||
highway = excluded.highway, subclass = excluded.subclass,
|
||||
brunnel = excluded.brunnel, network = excluded.network, route_1 = excluded.route_1,
|
||||
route_2 = excluded.route_2, route_3 = excluded.route_3, route_4 = excluded.route_4,
|
||||
route_5 = excluded.route_5, route_6 = excluded.route_6, z_order = excluded.z_order;
|
||||
route_5 = excluded.route_5, route_6 = excluded.route_6;
|
||||
|
||||
-- Analyze source table
|
||||
ANALYZE osm_transportation_name_linestring_gen3;
|
||||
@ -523,25 +566,36 @@ BEGIN
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen3 -> osm_transportation_name_linestring_gen4
|
||||
INSERT INTO osm_transportation_name_linestring_gen4 (id, geometry, tags, ref, highway, subclass, brunnel, network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6, z_order)
|
||||
SELECT id, ST_Simplify(geometry, 500) AS geometry, tags, ref, highway, subclass, brunnel, network, route_1, route_2,
|
||||
route_3, route_4, route_5, route_6, z_order
|
||||
route_1, route_2, route_3, route_4, route_5, route_6)
|
||||
SELECT MIN(id) as id,
|
||||
ST_Simplify(ST_LineMerge(ST_Collect(geometry)), 500) AS geometry,
|
||||
tags, ref, highway, subclass, brunnel, network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6
|
||||
FROM (
|
||||
SELECT id,
|
||||
(ST_Dump(geometry)).geom AS geometry,
|
||||
tags, ref, highway, subclass,
|
||||
visible_text(geometry, brunnel, 6) AS brunnel,
|
||||
network, route_1, route_2, route_3, route_4, route_5, route_6
|
||||
FROM osm_transportation_name_linestring_gen3
|
||||
) osm_transportation_name_linestring_gen4_pre_merge
|
||||
WHERE (
|
||||
full_update IS TRUE OR EXISTS (
|
||||
SELECT NULL
|
||||
FROM transportation_name.name_changes_gen
|
||||
WHERE transportation_name.name_changes_gen.is_old IS FALSE AND
|
||||
transportation_name.name_changes_gen.id = osm_transportation_name_linestring_gen3.id
|
||||
transportation_name.name_changes_gen.id = osm_transportation_name_linestring_gen4_pre_merge.id
|
||||
)
|
||||
) AND (
|
||||
(highway = 'motorway' OR highway = 'construction' AND subclass = 'motorway') AND
|
||||
ST_Length(geometry) > 20000
|
||||
) ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, tags = excluded.tags, ref = excluded.ref,
|
||||
ST_Length(geometry) > 20000 AND
|
||||
(highway = 'motorway' OR highway = 'construction' AND subclass = 'motorway')
|
||||
)
|
||||
GROUP BY tags, ref, highway, subclass, brunnel, network, route_1, route_2, route_3, route_4, route_5, route_6
|
||||
ON CONFLICT (id) DO UPDATE SET geometry = excluded.geometry, tags = excluded.tags, ref = excluded.ref,
|
||||
highway = excluded.highway, subclass = excluded.subclass,
|
||||
brunnel = excluded.brunnel, network = excluded.network, route_1 = excluded.route_1,
|
||||
route_2 = excluded.route_2, route_3 = excluded.route_3, route_4 = excluded.route_4,
|
||||
route_5 = excluded.route_5, route_6 = excluded.route_6, z_order = excluded.z_order;
|
||||
route_5 = excluded.route_5, route_6 = excluded.route_6;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM transportation_name.name_changes_gen;
|
||||
@ -720,12 +774,12 @@ BEGIN
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN layer END AS layer,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN level END AS level,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN indoor END AS indoor,
|
||||
NULLIF(rm1.network, '') || '=' || COALESCE(rm1.ref, '') AS route_1,
|
||||
NULLIF(rm2.network, '') || '=' || COALESCE(rm2.ref, '') AS route_2,
|
||||
NULLIF(rm3.network, '') || '=' || COALESCE(rm3.ref, '') AS route_3,
|
||||
NULLIF(rm4.network, '') || '=' || COALESCE(rm4.ref, '') AS route_4,
|
||||
NULLIF(rm5.network, '') || '=' || COALESCE(rm5.ref, '') AS route_5,
|
||||
NULLIF(rm6.network, '') || '=' || COALESCE(rm6.ref, '') AS route_6,
|
||||
create_route_hstore(rm1.network, rm1.ref, rm1.name, rm1.colour, rm1.ref_colour) AS route_1,
|
||||
create_route_hstore(rm2.network, rm2.ref, rm2.name, rm2.colour, rm2.ref_colour) AS route_2,
|
||||
create_route_hstore(rm3.network, rm3.ref, rm3.name, rm3.colour, rm3.ref_colour) AS route_3,
|
||||
create_route_hstore(rm4.network, rm4.ref, rm4.name, rm4.colour, rm4.ref_colour) AS route_4,
|
||||
create_route_hstore(rm5.network, rm5.ref, rm5.name, rm5.colour, rm5.ref_colour) AS route_5,
|
||||
create_route_hstore(rm6.network, rm6.ref, rm6.name, rm6.colour, rm6.ref_colour) AS route_6,
|
||||
hl.z_order,
|
||||
LEAST(rm1.rank, rm2.rank, rm3.rank, rm4.rank, rm5.rank, rm6.rank) AS route_rank
|
||||
FROM osm_highway_linestring hl
|
||||
@ -787,6 +841,12 @@ EXECUTE PROCEDURE transportation_name.refresh_network();
|
||||
-- osm_transportation_name_linestring -> osm_transportation_name_linestring_gen3
|
||||
-- osm_transportation_name_linestring -> osm_transportation_name_linestring_gen4
|
||||
|
||||
CREATE OR REPLACE AGGREGATE array_cat_agg(anycompatiblearray) (
|
||||
SFUNC=array_cat,
|
||||
STYPE=anycompatiblearray,
|
||||
INITCOND = '{}'
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS transportation_name.name_changes
|
||||
(
|
||||
is_old boolean,
|
||||
@ -974,8 +1034,8 @@ BEGIN
|
||||
-- Create a table containing all LineStrings which should be merged
|
||||
CREATE TEMPORARY TABLE linestrings_to_merge AS
|
||||
-- Add all Source-LineStrings affected by this update
|
||||
SELECT osm_id, NULL::INTEGER AS id, geometry, tags, ref, highway, subclass, brunnel, sac_scale, level, layer,
|
||||
indoor, network_type, route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
SELECT osm_id, NULL::INTEGER AS id, NULL::BIGINT[] AS source_ids, geometry, tags, ref, highway, subclass, brunnel,
|
||||
sac_scale, level, layer, indoor, network_type, route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
z_order, route_rank
|
||||
FROM (
|
||||
-- Get Source-LineString-IDs of deleted or updated elements
|
||||
@ -987,27 +1047,30 @@ BEGIN
|
||||
ORDER BY source_id
|
||||
) affected_source_linestrings
|
||||
JOIN osm_transportation_name_network ON (
|
||||
affected_source_linestrings.source_id = osm_transportation_name_network.osm_id AND
|
||||
coalesce(tags->'name', '') <> '' OR coalesce(ref, '') <> ''
|
||||
);
|
||||
affected_source_linestrings.source_id = osm_transportation_name_network.osm_id
|
||||
)
|
||||
WHERE coalesce(tags->'name', '') <> '' OR coalesce(ref, '') <> '';
|
||||
|
||||
-- Drop temporary tables early to save resources
|
||||
DROP TABLE affected_merged_linestrings;
|
||||
|
||||
-- Create index on geometry column and analyze the created table to speed up subsequent queries
|
||||
CREATE INDEX ON linestrings_to_merge USING GIST (geometry);
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
|
||||
-- Add all Merged-LineStrings intersecting with Source-LineStrings affected by this update
|
||||
INSERT INTO linestrings_to_merge
|
||||
SELECT s.source_id AS osm_id, m.id, geometry, tags, ref, highway, subclass, brunnel, sac_scale, level,
|
||||
layer, indoor, network AS network_type, route_1, route_2, route_3, route_4, route_5, route_6, z_order,
|
||||
route_rank
|
||||
FROM osm_transportation_name_linestring m
|
||||
JOIN osm_transportation_name_linestring_source_ids s ON (s.source = 0 AND m.id = s.id)
|
||||
WHERE EXISTS(
|
||||
SELECT NULL FROM linestrings_to_merge WHERE ST_Intersects(linestrings_to_merge.geometry, m.geometry)
|
||||
);
|
||||
SELECT NULL::BIGINT AS osm_id, m.id,
|
||||
ARRAY(
|
||||
SELECT s.source_id
|
||||
FROM osm_transportation_name_linestring_source_ids s
|
||||
WHERE s.source = 0 AND m.id = s.id
|
||||
)::BIGINT[] AS source_ids,
|
||||
m.geometry, m.tags, m.ref, m.highway, m.subclass, m.brunnel, m.sac_scale,
|
||||
m.level, m.layer, m.indoor, m.network AS network_type, m.route_1, m.route_2, m.route_3,
|
||||
m.route_4, m.route_5, m.route_6, m.z_order, m.route_rank
|
||||
FROM linestrings_to_merge
|
||||
JOIN osm_transportation_name_linestring m ON (ST_Intersects(linestrings_to_merge.geometry, m.geometry))
|
||||
WHERE m.source = 0;
|
||||
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
@ -1050,16 +1113,13 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID column to store relations before they have been
|
||||
-- intersected
|
||||
ALTER TABLE osm_transportation_name_linestring ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
INSERT INTO osm_transportation_name_linestring(source, geometry, source_ids, tags, ref, highway, subclass,
|
||||
brunnel, sac_scale, "level", layer, indoor, network, route_1,
|
||||
route_2, route_3, route_4, route_5, route_6,z_order, route_rank)
|
||||
INSERT INTO osm_transportation_name_linestring(source, geometry, new_source_ids, old_source_ids, tags, ref,
|
||||
highway, subclass, brunnel, sac_scale, "level", layer, indoor,
|
||||
network, route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
z_order, route_rank)
|
||||
SELECT 0 AS source, (ST_Dump(ST_LineMerge(ST_Union(geometry)))).geom AS geometry,
|
||||
-- We use St_Union instead of St_Collect to ensure no overlapping points exist within the geometries
|
||||
-- to merge. https://postgis.net/docs/ST_Union.html
|
||||
@ -1068,13 +1128,15 @@ BEGIN
|
||||
-- https://postgis.net/docs/ST_LineMerge.html
|
||||
-- In order to not end up with a mixture of LineStrings and MultiLineStrings we dump eventual
|
||||
-- MultiLineStrings via ST_Dump. https://postgis.net/docs/ST_Dump.html
|
||||
array_agg(osm_id) AS source_ids, tags, ref, highway, subclass, brunnel, sac_scale, level, layer,
|
||||
indoor, network_type, route_1, route_2, route_3, route_4, route_5, route_6, min(z_order) AS z_order,
|
||||
min(route_rank) AS route_rank
|
||||
coalesce( array_agg(osm_id) FILTER (WHERE osm_id IS NOT NULL), '{}' )::BIGINT[] AS new_source_ids,
|
||||
array_cat_agg(source_ids)::BIGINT[] as old_source_ids,
|
||||
tags, ref, highway, subclass, brunnel, sac_scale, level, layer,
|
||||
indoor, network_type, route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
min(z_order) AS z_order, min(route_rank) AS route_rank
|
||||
FROM clustered_linestrings_to_merge
|
||||
GROUP BY cluster_group, cluster, tags, ref, highway, subclass, brunnel, level, layer, sac_scale, indoor,
|
||||
network_type, route_1, route_2, route_3, route_4, route_5, route_6
|
||||
RETURNING source, id, source_ids, geometry
|
||||
RETURNING source, id, new_source_ids, old_source_ids, geometry
|
||||
)
|
||||
-- Store OSM-IDs of Source-LineStrings by intersecting Merged-LineStrings with their sources.
|
||||
-- This is required because ST_LineMerge only merges across singular intersections and groups its output into a
|
||||
@ -1082,8 +1144,14 @@ BEGIN
|
||||
INSERT INTO osm_transportation_name_linestring_source_ids (source, id, source_id)
|
||||
SELECT m.source, m.id, source_id
|
||||
FROM (
|
||||
SELECT source, id, unnest(source_ids) AS source_id, geometry
|
||||
SELECT source, id, source_id, geometry
|
||||
FROM inserted_linestrings
|
||||
CROSS JOIN LATERAL (
|
||||
SELECT DISTINCT all_source_ids.source_id
|
||||
FROM unnest(
|
||||
array_cat(inserted_linestrings.new_source_ids, inserted_linestrings.old_source_ids)
|
||||
) AS all_source_ids(source_id)
|
||||
) source_ids
|
||||
) m
|
||||
JOIN osm_transportation_name_network s ON (m.source_id = s.osm_id)
|
||||
WHERE ST_Intersects(s.geometry, m.geometry)
|
||||
@ -1092,8 +1160,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID column
|
||||
ALTER TABLE osm_transportation_name_linestring DROP COLUMN IF EXISTS source_ids;
|
||||
-- Restore temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
UPDATE osm_transportation_name_linestring SET new_source_ids = NULL WHERE new_source_ids IS NOT NULL;
|
||||
UPDATE osm_transportation_name_linestring SET old_source_ids = NULL WHERE old_source_ids IS NOT NULL;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM transportation_name.name_changes;
|
||||
@ -1119,7 +1188,7 @@ BEGIN
|
||||
-- REFRESH osm_transportation_name_linestring from osm_shipway_linestring
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE transportation_name.name_changes;
|
||||
ANALYZE transportation_name.shipway_changes;
|
||||
ANALYZE osm_shipway_linestring;
|
||||
|
||||
-- Fetch updated and deleted Merged-LineString from relation-table filtering for each Merged-LineString which
|
||||
@ -1155,7 +1224,7 @@ BEGIN
|
||||
-- Create a table containing all LineStrings which should be merged
|
||||
CREATE TEMPORARY TABLE linestrings_to_merge AS
|
||||
-- Add all Source-LineStrings affected by this update
|
||||
SELECT osm_id, NULL::INTEGER AS id, geometry,
|
||||
SELECT osm_id, NULL::INTEGER AS id, NULL::BIGINT[] AS source_ids, geometry,
|
||||
transportation_name_tags(
|
||||
NULL::geometry, tags, name, name_en, name_de
|
||||
) AS tags, shipway AS subclass, layer, z_order
|
||||
@ -1169,25 +1238,28 @@ BEGIN
|
||||
ORDER BY source_id
|
||||
) affected_source_linestrings
|
||||
JOIN osm_shipway_linestring ON (
|
||||
affected_source_linestrings.source_id = osm_shipway_linestring.osm_id AND
|
||||
name <> ''
|
||||
);
|
||||
affected_source_linestrings.source_id = osm_shipway_linestring.osm_id
|
||||
)
|
||||
WHERE name <> '';
|
||||
|
||||
-- Drop temporary tables early to save resources
|
||||
DROP TABLE affected_merged_linestrings;
|
||||
|
||||
-- Create index on geometry column and analyze the created table to speed up subsequent queries
|
||||
CREATE INDEX ON linestrings_to_merge USING GIST (geometry);
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
|
||||
-- Add all Merged-LineStrings intersecting with Source-LineStrings affected by this update
|
||||
INSERT INTO linestrings_to_merge
|
||||
SELECT s.source_id AS osm_id, m.id, geometry, tags, subclass, layer, z_order
|
||||
FROM osm_transportation_name_linestring m
|
||||
JOIN osm_transportation_name_linestring_source_ids s ON (s.source = 1 AND m.id = s.id)
|
||||
WHERE EXISTS(
|
||||
SELECT NULL FROM linestrings_to_merge WHERE ST_Intersects(linestrings_to_merge.geometry, m.geometry)
|
||||
);
|
||||
SELECT NULL::BIGINT AS osm_id, m.id,
|
||||
ARRAY(
|
||||
SELECT s.source_id
|
||||
FROM osm_transportation_name_linestring_source_ids s
|
||||
WHERE s.source = 1 AND m.id = s.id
|
||||
)::BIGINT[] AS source_ids,
|
||||
m.geometry, m.tags, m.subclass, m.layer, m.z_order
|
||||
FROM linestrings_to_merge
|
||||
JOIN osm_transportation_name_linestring m ON (ST_Intersects(linestrings_to_merge.geometry, m.geometry))
|
||||
WHERE m.source = 1;
|
||||
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
@ -1224,14 +1296,11 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID column to store relations before they have been
|
||||
-- intersected
|
||||
ALTER TABLE osm_transportation_name_linestring ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
INSERT INTO osm_transportation_name_linestring(source, geometry, source_ids, tags, highway, subclass,
|
||||
z_order)
|
||||
INSERT INTO osm_transportation_name_linestring(source, geometry, new_source_ids, old_source_ids, tags, highway,
|
||||
subclass, z_order)
|
||||
SELECT 1 AS source, (ST_Dump(ST_LineMerge(ST_Union(geometry)))).geom AS geometry,
|
||||
-- We use St_Union instead of St_Collect to ensure no overlapping points exist within the geometries
|
||||
-- to merge. https://postgis.net/docs/ST_Union.html
|
||||
@ -1240,10 +1309,12 @@ BEGIN
|
||||
-- https://postgis.net/docs/ST_LineMerge.html
|
||||
-- In order to not end up with a mixture of LineStrings and MultiLineStrings we dump eventual
|
||||
-- MultiLineStrings via ST_Dump. https://postgis.net/docs/ST_Dump.html
|
||||
array_agg(osm_id) AS source_ids, tags, 'shipway' AS highway, subclass, min(z_order) AS z_order
|
||||
coalesce( array_agg(osm_id) FILTER (WHERE osm_id IS NOT NULL), '{}' )::BIGINT[] AS new_source_ids,
|
||||
array_cat_agg(source_ids)::BIGINT[] as old_source_ids,
|
||||
tags, 'shipway' AS highway, subclass, min(z_order) AS z_order
|
||||
FROM clustered_linestrings_to_merge
|
||||
GROUP BY cluster_group, cluster, tags, subclass, layer
|
||||
RETURNING source, id, source_ids, geometry
|
||||
RETURNING source, id, new_source_ids, old_source_ids, geometry
|
||||
)
|
||||
-- Store OSM-IDs of Source-LineStrings by intersecting Merged-LineStrings with their sources.
|
||||
-- This is required because ST_LineMerge only merges across singular intersections and groups its output into a
|
||||
@ -1251,8 +1322,14 @@ BEGIN
|
||||
INSERT INTO osm_transportation_name_linestring_source_ids (source, id, source_id)
|
||||
SELECT m.source, m.id, source_id
|
||||
FROM (
|
||||
SELECT source, id, unnest(source_ids) AS source_id, geometry
|
||||
SELECT source, id, source_id, geometry
|
||||
FROM inserted_linestrings
|
||||
CROSS JOIN LATERAL (
|
||||
SELECT DISTINCT all_source_ids.source_id
|
||||
FROM unnest(
|
||||
array_cat(inserted_linestrings.new_source_ids, inserted_linestrings.old_source_ids)
|
||||
) AS all_source_ids(source_id)
|
||||
) source_ids
|
||||
) m
|
||||
JOIN osm_shipway_linestring s ON (m.source_id = s.osm_id)
|
||||
WHERE ST_Intersects(s.geometry, m.geometry)
|
||||
@ -1261,8 +1338,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID column
|
||||
ALTER TABLE osm_transportation_name_linestring DROP COLUMN IF EXISTS source_ids;
|
||||
-- Restore temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
UPDATE osm_transportation_name_linestring SET new_source_ids = NULL WHERE new_source_ids IS NOT NULL;
|
||||
UPDATE osm_transportation_name_linestring SET old_source_ids = NULL WHERE old_source_ids IS NOT NULL;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM transportation_name.shipway_changes;
|
||||
@ -1288,7 +1366,7 @@ BEGIN
|
||||
-- REFRESH osm_transportation_name_linestring from osm_aerialway_linestring
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE transportation_name.name_changes;
|
||||
ANALYZE transportation_name.aerialway_changes;
|
||||
ANALYZE osm_aerialway_linestring;
|
||||
|
||||
-- Fetch updated and deleted Merged-LineString from relation-table filtering for each Merged-LineString which
|
||||
@ -1324,7 +1402,7 @@ BEGIN
|
||||
-- Create a table containing all LineStrings which should be merged
|
||||
CREATE TEMPORARY TABLE linestrings_to_merge AS
|
||||
-- Add all Source-LineStrings affected by this update
|
||||
SELECT osm_id, NULL::INTEGER AS id, geometry,
|
||||
SELECT osm_id, NULL::INTEGER AS id, NULL::BIGINT[] AS source_ids, geometry,
|
||||
transportation_name_tags(
|
||||
NULL::geometry, tags, name, name_en, name_de
|
||||
) AS tags, aerialway AS subclass, layer, z_order
|
||||
@ -1338,25 +1416,28 @@ BEGIN
|
||||
ORDER BY source_id
|
||||
) affected_source_linestrings
|
||||
JOIN osm_aerialway_linestring ON (
|
||||
affected_source_linestrings.source_id = osm_aerialway_linestring.osm_id AND
|
||||
name <> ''
|
||||
);
|
||||
affected_source_linestrings.source_id = osm_aerialway_linestring.osm_id
|
||||
)
|
||||
WHERE name <> '';
|
||||
|
||||
-- Drop temporary tables early to save resources
|
||||
DROP TABLE affected_merged_linestrings;
|
||||
|
||||
-- Create index on geometry column and analyze the created table to speed up subsequent queries
|
||||
CREATE INDEX ON linestrings_to_merge USING GIST (geometry);
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
|
||||
-- Add all Merged-LineStrings intersecting with Source-LineStrings affected by this update
|
||||
INSERT INTO linestrings_to_merge
|
||||
SELECT s.source_id AS osm_id, m.id, geometry, tags, subclass, layer, z_order
|
||||
FROM osm_transportation_name_linestring m
|
||||
JOIN osm_transportation_name_linestring_source_ids s ON (s.source = 2 AND m.id = s.id)
|
||||
WHERE EXISTS(
|
||||
SELECT NULL FROM linestrings_to_merge WHERE ST_Intersects(linestrings_to_merge.geometry, m.geometry)
|
||||
);
|
||||
SELECT NULL::BIGINT AS osm_id, m.id,
|
||||
ARRAY(
|
||||
SELECT s.source_id
|
||||
FROM osm_transportation_name_linestring_source_ids s
|
||||
WHERE s.source = 2 AND m.id = s.id
|
||||
)::BIGINT[] AS source_ids,
|
||||
m.geometry, m.tags, m.subclass, m.layer, m.z_order
|
||||
FROM linestrings_to_merge
|
||||
JOIN osm_transportation_name_linestring m ON (ST_Intersects(linestrings_to_merge.geometry, m.geometry))
|
||||
WHERE m.source = 2;
|
||||
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
@ -1393,14 +1474,11 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID column to store relations before they have been
|
||||
-- intersected
|
||||
ALTER TABLE osm_transportation_name_linestring ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
INSERT INTO osm_transportation_name_linestring(source, geometry, source_ids, tags, highway, subclass,
|
||||
z_order)
|
||||
INSERT INTO osm_transportation_name_linestring(source, geometry, new_source_ids, old_source_ids, tags, highway,
|
||||
subclass, z_order)
|
||||
SELECT 2 AS source, (ST_Dump(ST_LineMerge(ST_Union(geometry)))).geom AS geometry,
|
||||
-- We use St_Union instead of St_Collect to ensure no overlapping points exist within the geometries
|
||||
-- to merge. https://postgis.net/docs/ST_Union.html
|
||||
@ -1409,10 +1487,12 @@ BEGIN
|
||||
-- https://postgis.net/docs/ST_LineMerge.html
|
||||
-- In order to not end up with a mixture of LineStrings and MultiLineStrings we dump eventual
|
||||
-- MultiLineStrings via ST_Dump. https://postgis.net/docs/ST_Dump.html
|
||||
array_agg(osm_id) AS source_ids, tags, 'aerialway' AS highway, subclass, min(z_order) AS z_order
|
||||
coalesce( array_agg(osm_id) FILTER (WHERE osm_id IS NOT NULL), '{}' )::BIGINT[] AS new_source_ids,
|
||||
array_cat_agg(source_ids)::BIGINT[] as old_source_ids,
|
||||
tags, 'aerialway' AS highway, subclass, min(z_order) AS z_order
|
||||
FROM clustered_linestrings_to_merge
|
||||
GROUP BY cluster_group, cluster, tags, subclass, layer
|
||||
RETURNING source, id, source_ids, geometry
|
||||
RETURNING source, id, new_source_ids, old_source_ids, geometry
|
||||
)
|
||||
-- Store OSM-IDs of Source-LineStrings by intersecting Merged-LineStrings with their sources.
|
||||
-- This is required because ST_LineMerge only merges across singular intersections and groups its output into a
|
||||
@ -1420,8 +1500,14 @@ BEGIN
|
||||
INSERT INTO osm_transportation_name_linestring_source_ids (source, id, source_id)
|
||||
SELECT m.source, m.id, source_id
|
||||
FROM (
|
||||
SELECT source, id, unnest(source_ids) AS source_id, geometry
|
||||
SELECT source, id, source_id, geometry
|
||||
FROM inserted_linestrings
|
||||
CROSS JOIN LATERAL (
|
||||
SELECT DISTINCT all_source_ids.source_id
|
||||
FROM unnest(
|
||||
array_cat(inserted_linestrings.new_source_ids, inserted_linestrings.old_source_ids)
|
||||
) AS all_source_ids(source_id)
|
||||
) source_ids
|
||||
) m
|
||||
JOIN osm_aerialway_linestring s ON (m.source_id = s.osm_id)
|
||||
WHERE ST_Intersects(s.geometry, m.geometry)
|
||||
@ -1430,8 +1516,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID column
|
||||
ALTER TABLE osm_transportation_name_linestring DROP COLUMN IF EXISTS source_ids;
|
||||
-- Restore temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
UPDATE osm_transportation_name_linestring SET new_source_ids = NULL WHERE new_source_ids IS NOT NULL;
|
||||
UPDATE osm_transportation_name_linestring SET old_source_ids = NULL WHERE old_source_ids IS NOT NULL;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM transportation_name.aerialway_changes;
|
||||
|
||||
@ -40,7 +40,7 @@ layer:
|
||||
river:
|
||||
water: ['river', 'stream', 'canal', 'ditch', 'drain']
|
||||
pond:
|
||||
water: ['pond', 'basin', 'wastewater']
|
||||
water: ['pond', 'basin', 'wastewater', 'salt_pond']
|
||||
lake:
|
||||
ocean:
|
||||
swimming_pool:
|
||||
|
||||
@ -18,9 +18,12 @@ $$
|
||||
SELECT osm.osm_id, ne.scalerank
|
||||
FROM osm_marine_point AS osm
|
||||
LEFT JOIN ne_10m_geography_marine_polys AS ne ON
|
||||
(
|
||||
lower(trim(regexp_replace(ne.name, '\\s+', ' ', 'g'))) IN (lower(osm.name), lower(osm.tags->'name:en'), lower(osm.tags->'name:es'))
|
||||
OR substring(lower(trim(regexp_replace(ne.name, '\\s+', ' ', 'g'))) FROM 1 FOR length(lower(osm.name))) = lower(osm.name)
|
||||
)
|
||||
AND ST_DWithin(ne.geometry, osm.geometry, 50000)
|
||||
)
|
||||
UPDATE osm_marine_point AS osm
|
||||
SET "rank" = scalerank
|
||||
FROM important_marine_point AS ne
|
||||
@ -90,12 +93,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_marine_point
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE water_name_marine.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_marine_point
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE water_name_marine.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -197,12 +197,14 @@ CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_water_polygon
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE water_name.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_water_polygon
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE water_name.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -9,9 +9,9 @@ layer:
|
||||
This is based of the [osm-lakelines](https://github.com/openmaptiles/osm-lakelines) project
|
||||
which derives nice centerlines from OSM water bodies. Only the most important lakes contain labels.
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the water body.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the water body. Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
class:
|
||||
description: |
|
||||
Distinguish between `lake`, `ocean`, `bay`, `strait`, and `sea`.
|
||||
|
||||
@ -21,18 +21,33 @@ CREATE TABLE IF NOT EXISTS osm_important_waterway_linestring (
|
||||
id SERIAL,
|
||||
geometry geometry('LineString'),
|
||||
source_ids bigint[],
|
||||
new_source_ids bigint[],
|
||||
old_source_ids bigint[],
|
||||
name varchar,
|
||||
name_en varchar,
|
||||
name_de varchar,
|
||||
tags hstore
|
||||
);
|
||||
|
||||
ALTER TABLE osm_important_waterway_linestring ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID columns to store relations before they have been
|
||||
-- intersected
|
||||
ALTER TABLE osm_important_waterway_linestring ADD COLUMN IF NOT EXISTS new_source_ids BIGINT[];
|
||||
ALTER TABLE osm_important_waterway_linestring ADD COLUMN IF NOT EXISTS old_source_ids BIGINT[];
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_n_source_ids_not_null_idx
|
||||
ON osm_important_waterway_linestring ((new_source_ids IS NOT NULL));
|
||||
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_o_source_ids_not_null_idx
|
||||
ON osm_important_waterway_linestring ((old_source_ids IS NOT NULL));
|
||||
|
||||
-- Create osm_important_waterway_linestring_gen_z11 as a copy of osm_important_waterway_linestring but drop the
|
||||
-- "source_ids" column. This can be done because z10 and z9 tables are only simplified and not merged, therefore
|
||||
-- relations to sources are direct via the id column.
|
||||
CREATE TABLE IF NOT EXISTS osm_important_waterway_linestring_gen_z11
|
||||
(LIKE osm_important_waterway_linestring);
|
||||
ALTER TABLE osm_important_waterway_linestring_gen_z11 DROP COLUMN IF EXISTS source_ids;
|
||||
ALTER TABLE osm_important_waterway_linestring_gen_z11 DROP COLUMN IF EXISTS new_source_ids;
|
||||
ALTER TABLE osm_important_waterway_linestring_gen_z11 DROP COLUMN IF EXISTS old_source_ids;
|
||||
|
||||
-- Create osm_important_waterway_linestring_gen_z10 as a copy of osm_important_waterway_linestring_gen_z11
|
||||
CREATE TABLE IF NOT EXISTS osm_important_waterway_linestring_gen_z10
|
||||
@ -304,6 +319,12 @@ CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen_z9_geometry_idx
|
||||
-- -- osm_important_waterway_linestring -> osm_important_waterway_linestring_gen_z10
|
||||
-- -- osm_important_waterway_linestring -> osm_important_waterway_linestring_gen_z9
|
||||
|
||||
CREATE OR REPLACE AGGREGATE array_cat_agg(anycompatiblearray) (
|
||||
SFUNC=array_cat,
|
||||
STYPE=anycompatiblearray,
|
||||
INITCOND = '{}'
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS waterway_important.changes
|
||||
(
|
||||
osm_id bigint,
|
||||
@ -403,7 +424,8 @@ BEGIN
|
||||
-- Create a table containing all LineStrings which should be merged
|
||||
CREATE TEMPORARY TABLE linestrings_to_merge AS
|
||||
-- Add all Source-LineStrings affected by this update
|
||||
SELECT osm_id, NULL::INTEGER AS id, geometry, name, name_en, name_de, slice_language_tags(tags) as tags
|
||||
SELECT osm_id, NULL::INTEGER AS id, NULL::BIGINT[] AS source_ids, geometry, name, name_en, name_de,
|
||||
slice_language_tags(tags) as tags
|
||||
-- Table containing the IDs of all Source-LineStrings affected by this update
|
||||
FROM (
|
||||
-- Get Source-LineString-IDs of deleted or updated elements
|
||||
@ -414,23 +436,25 @@ BEGIN
|
||||
ORDER BY source_id
|
||||
) affected_source_linestrings
|
||||
JOIN osm_waterway_linestring ON (
|
||||
affected_source_linestrings.source_id = osm_waterway_linestring.osm_id AND
|
||||
name <> '' AND waterway = 'river' AND ST_IsValid(geometry)
|
||||
);
|
||||
affected_source_linestrings.source_id = osm_waterway_linestring.osm_id
|
||||
)
|
||||
WHERE name <> '' AND waterway = 'river' AND ST_IsValid(geometry);
|
||||
|
||||
-- Drop temporary tables early to save resources
|
||||
DROP TABLE affected_merged_linestrings;
|
||||
|
||||
-- Create index on geometry column and analyze the created table to speed up subsequent queries
|
||||
CREATE INDEX ON linestrings_to_merge USING GIST (geometry);
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
|
||||
-- Add all Merged-LineStrings intersecting with Source-LineStrings affected by this update
|
||||
INSERT INTO linestrings_to_merge
|
||||
SELECT s.source_id AS osm_id, m.id, geometry, name, name_en, name_de, tags
|
||||
FROM osm_important_waterway_linestring m
|
||||
JOIN osm_important_waterway_linestring_source_ids s ON (m.id = s.id)
|
||||
WHERE EXISTS(SELECT NULL FROM linestrings_to_merge WHERE ST_Intersects(linestrings_to_merge.geometry, m.geometry));
|
||||
SELECT NULL::BIGINT AS osm_id, m.id,
|
||||
ARRAY(
|
||||
SELECT s.source_id FROM osm_important_waterway_linestring_source_ids s WHERE s.id = m.id
|
||||
)::BIGINT[] AS source_ids,
|
||||
m.geometry, m.name, m.name_en, m.name_de, m.tags
|
||||
FROM linestrings_to_merge
|
||||
JOIN osm_important_waterway_linestring m ON (ST_Intersects(linestrings_to_merge.geometry, m.geometry));
|
||||
|
||||
-- Analyze the created table to speed up subsequent queries
|
||||
ANALYZE linestrings_to_merge;
|
||||
@ -467,13 +491,11 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID column to store relations before they have been
|
||||
-- intersected
|
||||
ALTER TABLE osm_important_waterway_linestring ADD COLUMN IF NOT EXISTS source_ids bigint[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
INSERT INTO osm_important_waterway_linestring (geometry, source_ids, name, name_en, name_de, tags)
|
||||
INSERT INTO osm_important_waterway_linestring (geometry, new_source_ids, old_source_ids, name, name_en, name_de,
|
||||
tags)
|
||||
SELECT (ST_Dump(ST_LineMerge(ST_Union(geometry)))).geom AS geometry,
|
||||
-- We use St_Union instead of St_Collect to ensure no overlapping points exist within the geometries
|
||||
-- to merge. https://postgis.net/docs/ST_Union.html
|
||||
@ -482,14 +504,15 @@ BEGIN
|
||||
-- https://postgis.net/docs/ST_LineMerge.html
|
||||
-- In order to not end up with a mixture of LineStrings and MultiLineStrings we dump eventual
|
||||
-- MultiLineStrings via ST_Dump. https://postgis.net/docs/ST_Dump.html
|
||||
array_agg(osm_id) as source_ids,
|
||||
coalesce( array_agg(osm_id) FILTER (WHERE osm_id IS NOT NULL), '{}' )::BIGINT[] AS new_source_ids,
|
||||
array_cat_agg(source_ids)::BIGINT[] as old_source_ids,
|
||||
name,
|
||||
name_en,
|
||||
name_de,
|
||||
tags
|
||||
FROM clustered_linestrings_to_merge
|
||||
GROUP BY cluster_group, cluster, name, name_en, name_de, tags
|
||||
RETURNING id, source_ids, geometry
|
||||
RETURNING id, new_source_ids, old_source_ids, geometry
|
||||
)
|
||||
-- Store OSM-IDs of Source-LineStrings by intersecting Merged-LineStrings with their sources.
|
||||
-- This is required because ST_LineMerge only merges across singular intersections and groups its output into a
|
||||
@ -497,8 +520,14 @@ BEGIN
|
||||
INSERT INTO osm_important_waterway_linestring_source_ids (id, source_id)
|
||||
SELECT m.id, source_id
|
||||
FROM (
|
||||
SELECT id, unnest(source_ids) AS source_id, geometry
|
||||
SELECT id, source_id, geometry
|
||||
FROM inserted_linestrings
|
||||
CROSS JOIN LATERAL (
|
||||
SELECT DISTINCT all_source_ids.source_id
|
||||
FROM unnest(
|
||||
array_cat(inserted_linestrings.new_source_ids, inserted_linestrings.old_source_ids)
|
||||
) AS all_source_ids(source_id)
|
||||
) source_ids
|
||||
) m
|
||||
JOIN osm_waterway_linestring s ON (m.source_id = s.osm_id)
|
||||
WHERE ST_Intersects(s.geometry, m.geometry)
|
||||
@ -507,8 +536,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID column
|
||||
ALTER TABLE osm_important_waterway_linestring DROP COLUMN IF EXISTS source_ids;
|
||||
-- Restore temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
UPDATE osm_important_waterway_linestring SET new_source_ids = NULL WHERE new_source_ids IS NOT NULL;
|
||||
UPDATE osm_important_waterway_linestring SET old_source_ids = NULL WHERE old_source_ids IS NOT NULL;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM waterway_important.changes;
|
||||
@ -528,18 +558,21 @@ CREATE TRIGGER trigger_important_waterway_linestring_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_important_waterway_linestring
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE waterway_important.important_waterway_linestring_store();
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_waterway_linestring
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE waterway_important.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_waterway_linestring
|
||||
FOR EACH STATEMENT
|
||||
WHEN (pg_trigger_depth() < 1)
|
||||
EXECUTE PROCEDURE waterway_important.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
|
||||
@ -18,10 +18,10 @@ layer:
|
||||
buffer_size: 4
|
||||
fields:
|
||||
name: |
|
||||
The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the waterway.
|
||||
The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the waterway. Language-specific values are in `name:xx`.
|
||||
The `name` field may be empty for NaturalEarth data or at lower zoom levels.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
class:
|
||||
description: |
|
||||
The original value of the [`waterway`](http://wiki.openstreetmap.org/wiki/Key:waterway) tag.
|
||||
|
||||
@ -19,7 +19,7 @@ tileset:
|
||||
- layers/landmarks/landmark.yaml
|
||||
- layers/aerodrome_label/aerodrome_label.yaml
|
||||
name: OpenMapTiles
|
||||
version: 3.14.0
|
||||
version: 3.15.0
|
||||
id: openmaptiles
|
||||
description: "A tileset showcasing all layers in OpenMapTiles. https://openmaptiles.org"
|
||||
attribution: '<a href="https://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>'
|
||||
@ -100,6 +100,7 @@ tileset:
|
||||
- ta # Tamil
|
||||
- te # Telugu
|
||||
- th # Thai
|
||||
- tok # Toki Pona
|
||||
- tr # Turkish, Latin
|
||||
- uk # Ukrainian
|
||||
- ur # Urdu
|
||||
|
||||
@ -163,6 +163,8 @@ else
|
||||
echo " "
|
||||
fi
|
||||
|
||||
MBTILES_FILE=${MBTILES_FILE:-$(source .env ; echo "$MBTILES_FILE")}
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Stopping running services & removing old containers"
|
||||
@ -180,8 +182,8 @@ make init-dirs
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Removing old MBTILES if exists ( ./data/${area}.mbtiles ) "
|
||||
rm -f "./data/${area}.mbtiles"
|
||||
echo "====> : Removing old MBTILES if exists ( ./data/$MBTILES_FILE ) "
|
||||
rm -f "./data/$MBTILES_FILE"
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
@ -292,7 +294,7 @@ fi
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Start generating MBTiles (containing gzipped MVT PBF) using PostGIS. "
|
||||
echo " : Output MBTiles: ./data/${area}.mbtiles "
|
||||
echo " : Output MBTiles: $MBTILES_FILE "
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/blob/master/bin/generate-tiles "
|
||||
make generate-tiles-pg
|
||||
|
||||
@ -306,8 +308,7 @@ echo "--------------------------------------------------------------------------
|
||||
echo "====> : Inputs - Outputs md5sum for debugging "
|
||||
rm -f ./data/quickstart_checklist.chk
|
||||
{
|
||||
find build -type f | sort | xargs md5sum
|
||||
find data -type f | sort | xargs md5sum
|
||||
find build data -type f -exec md5sum {} + | sort -k2
|
||||
} >> ./data/quickstart_checklist.chk
|
||||
cat ./data/quickstart_checklist.chk
|
||||
|
||||
@ -326,7 +327,7 @@ docker images | grep openmaptiles
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : (disk space) We have created the new vectortiles ( ./data/${area}.mbtiles ) "
|
||||
echo "====> : (disk space) We have created the new vectortiles ( ./data/$MBTILES_FILE ) "
|
||||
echo " : Please respect the licenses (OdBL for OSM data) of the sources when distributing the MBTiles file."
|
||||
echo " : Data directory content:"
|
||||
ls -la ./data
|
||||
@ -350,8 +351,11 @@ echo " Acknowledgments "
|
||||
echo " Generated vector tiles are produced work of OpenStreetMap data. "
|
||||
echo " Such tiles are reusable under CC-BY license granted by OpenMapTiles team: "
|
||||
echo " https://github.com/openmaptiles/openmaptiles/#license "
|
||||
echo " Maps made with these vector tiles must display a visible credit: "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo " "
|
||||
echo -e "\033[1m Maps made with these vector tiles must display a visible credit:\033[0m "
|
||||
echo " © OpenMapTiles © OpenStreetMap contributors "
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo " Thanks to all free, open source software developers and Open Data Contributors! "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="14"
|
||||
height="14"
|
||||
viewBox="0 0 14 14"
|
||||
fill="none"
|
||||
version="1.1"
|
||||
id="svg29764"
|
||||
sodipodi:docname="chocolate.svg"
|
||||
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
|
||||
<metadata
|
||||
id="metadata29770">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs29768" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1265"
|
||||
inkscape:window-height="714"
|
||||
id="namedview29766"
|
||||
showgrid="false"
|
||||
inkscape:zoom="33.14"
|
||||
inkscape:cx="-0.18165359"
|
||||
inkscape:cy="7"
|
||||
inkscape:window-x="55"
|
||||
inkscape:window-y="56"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg29764"
|
||||
inkscape:pagecheckerboard="true"
|
||||
inkscape:document-rotation="0" />
|
||||
<circle
|
||||
style="fill:#c77400;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;paint-order:stroke fill markers;fill-opacity:1"
|
||||
id="path30353"
|
||||
cx="6.8497281"
|
||||
cy="7.0609536"
|
||||
r="2.6554012" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
24
style/icons/flowerbed_high_zoom.svg
Normal file
|
After Width: | Height: | Size: 96 KiB |
10
style/icons/gallery.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0)">
|
||||
<path d="M7 0C3.13444 0 0 3.13444 0 7C0 10.8656 3.13444 14 7 14C7.64556 14 8.16602 13.4795 8.16602 12.834C8.16602 12.5307 8.05384 12.2569 7.86328 12.0508C7.6805 11.8447 7.57227 11.5768 7.57227 11.2773C7.57227 10.6318 8.09273 10.1113 8.73828 10.1113H10.1113C12.258 10.1113 14 8.36932 14 6.22266C14 2.78488 10.8656 0 7 0V0ZM8.93359 1.30469C9.30185 1.30482 9.65499 1.45117 9.91539 1.71157C10.1758 1.97197 10.3221 2.3251 10.3223 2.69336C10.3225 2.87587 10.2867 3.05663 10.217 3.2253C10.1473 3.39398 10.045 3.54727 9.91608 3.67641C9.78711 3.80556 9.63397 3.90802 9.46539 3.97796C9.29681 4.04789 9.1161 4.08392 8.93359 4.08398C8.75109 4.08392 8.57038 4.04789 8.4018 3.97796C8.23322 3.90802 8.08007 3.80556 7.95111 3.67641C7.82215 3.54727 7.7199 3.39398 7.6502 3.2253C7.58051 3.05663 7.54473 2.87587 7.54492 2.69336C7.54506 2.3251 7.69141 1.97197 7.9518 1.71157C8.2122 1.45117 8.56534 1.30482 8.93359 1.30469V1.30469ZM5.03906 1.32422C5.22174 1.32403 5.40265 1.35987 5.57146 1.42969C5.74026 1.4995 5.89364 1.60193 6.02281 1.7311C6.15198 1.86027 6.2544 2.01365 6.32422 2.18245C6.39404 2.35125 6.42988 2.53217 6.42969 2.71484C6.42962 2.89735 6.39359 3.07806 6.32366 3.24664C6.25373 3.41522 6.15126 3.56836 6.02212 3.69733C5.89297 3.82629 5.73968 3.92854 5.57101 3.99823C5.40233 4.06793 5.22157 4.10371 5.03906 4.10352C4.67081 4.10338 4.31767 3.95703 4.05727 3.69663C3.79687 3.43624 3.65052 3.0831 3.65039 2.71484C3.6502 2.53234 3.68598 2.35158 3.75567 2.1829C3.82537 2.01422 3.92762 1.86093 4.05658 1.73179C4.18554 1.60265 4.33869 1.50018 4.50727 1.43025C4.67585 1.36031 4.85655 1.32429 5.03906 1.32422V1.32422ZM2.70703 4.44727C2.88954 4.44733 3.07025 4.48336 3.23883 4.55329C3.4074 4.62323 3.56055 4.72569 3.68951 4.85484C3.81848 4.98398 3.92073 5.13727 3.99042 5.30595C4.06012 5.47462 4.09589 5.65538 4.0957 5.83789C4.09557 6.20615 3.94922 6.55928 3.68882 6.81968C3.42842 7.08008 3.07529 7.22643 2.70703 7.22656C2.33877 7.22643 1.98564 7.08008 1.72524 6.81968C1.46484 6.55928 1.31849 6.20615 1.31836 5.83789C1.31817 5.65538 1.35394 5.47462 1.42364 5.30595C1.49334 5.13727 1.59559 4.98398 1.72455 4.85484C1.85351 4.72569 2.00666 4.62323 2.17524 4.55329C2.34382 4.48336 2.52452 4.44733 2.70703 4.44727V4.44727ZM11.2656 4.44727C11.4481 4.44733 11.6288 4.48336 11.7974 4.55329C11.966 4.62323 12.1191 4.72569 12.2481 4.85484C12.3771 4.98398 12.4793 5.13727 12.549 5.30595C12.6187 5.47462 12.6545 5.65538 12.6543 5.83789C12.6542 6.20615 12.5078 6.55928 12.2474 6.81968C11.987 7.08008 11.6339 7.22643 11.2656 7.22656C10.8974 7.22643 10.5442 7.08008 10.2838 6.81968C10.0234 6.55928 9.87709 6.20615 9.87695 5.83789C9.87676 5.65538 9.91254 5.47462 9.98223 5.30595C10.0519 5.13727 10.1542 4.98398 10.2831 4.85484C10.4121 4.72569 10.5653 4.62323 10.7338 4.55329C10.9024 4.48336 11.0831 4.44733 11.2656 4.44727V4.44727Z" fill="#734A08"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0">
|
||||
<rect width="14" height="14" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
@ -1,3 +1,3 @@
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M5 0C3.34315 0 2 1.34315 2 3C2 3.35553 2.07398 3.68353 2.1875 4H7.8125C7.92602 3.68353 8 3.35553 8 3C8 1.34315 6.65685 0 5 0ZM9 0C8.59614 0 8.22667 0.105305 7.875 0.25C8.56297 0.968413 9 1.92676 9 3C9 3.34678 8.93108 3.67901 8.84375 4H11.8125C11.926 3.68353 12 3.35553 12 3C12 1.34315 10.6569 0 9 0ZM3.25 5L7 14L10.75 5H3.25Z" fill="#AC39AC"/>
|
||||
<path d="M5 0C3.34315 0 2 1.34315 2 3C2 3.35553 2.07398 3.68353 2.1875 4H7.8125C7.92602 3.68353 8 3.35553 8 3C8 1.34315 6.65685 0 5 0ZM9 0C8.59614 0 8.22667 0.105305 7.875 0.25C8.56297 0.968413 9 1.92676 9 3C9 3.34678 8.93108 3.67901 8.84375 4H11.8125C11.926 3.68353 12 3.35553 12 3C12 1.34315 10.6569 0 9 0ZM3.25 5L7 14L10.75 5H3.25Z" fill="#C77400"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 456 B After Width: | Height: | Size: 456 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="14"
|
||||
height="14"
|
||||
viewBox="0 0 14 14"
|
||||
fill="none"
|
||||
version="1.1"
|
||||
id="svg29764"
|
||||
sodipodi:docname="tattoo.svg"
|
||||
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
|
||||
<metadata
|
||||
id="metadata29770">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs29768" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1265"
|
||||
inkscape:window-height="714"
|
||||
id="namedview29766"
|
||||
showgrid="false"
|
||||
inkscape:zoom="33.14"
|
||||
inkscape:cx="7"
|
||||
inkscape:cy="7"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="25"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg29764"
|
||||
inkscape:pagecheckerboard="true" />
|
||||
<circle
|
||||
style="fill:#ac39ac;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;paint-order:stroke fill markers"
|
||||
id="path30353"
|
||||
cx="6.8497281"
|
||||
cy="7.0609536"
|
||||
r="2.6554012" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
3
style/icons/volcano.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4 1L0 8H8L4 1Z" fill="#D40000"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 142 B |
@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="14"
|
||||
height="14"
|
||||
viewBox="0 0 14 14"
|
||||
fill="none"
|
||||
version="1.1"
|
||||
id="svg29764"
|
||||
sodipodi:docname="other.svg"
|
||||
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
|
||||
<metadata
|
||||
id="metadata29770">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs29768" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1265"
|
||||
inkscape:window-height="714"
|
||||
id="namedview29766"
|
||||
showgrid="false"
|
||||
inkscape:zoom="33.14"
|
||||
inkscape:cx="7"
|
||||
inkscape:cy="7"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="25"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg29764"
|
||||
inkscape:pagecheckerboard="true" />
|
||||
<circle
|
||||
style="fill:#ac39ac;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;paint-order:stroke fill markers"
|
||||
id="path30353"
|
||||
cx="6.8497281"
|
||||
cy="7.0609536"
|
||||
r="2.6554012" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
@ -28,4 +28,28 @@
|
||||
<tag k="amenity" v="parcel_locker"/>
|
||||
<tag k="operator" v="OpenMapTiles Parcel Locker"/>
|
||||
</node>
|
||||
<node id="600007" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.8" lon="-80.8">
|
||||
<tag k="amenity" v="charging_station"/>
|
||||
<tag k="name" v="OpenMapTiles Charging Station"/>
|
||||
<tag k="brand" v="OpenMapTiles Charging Station Brand"/>
|
||||
</node>
|
||||
<node id="600008" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.0" lon="-80.0" />
|
||||
<node id="600009" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.1" lon="-80.0" />
|
||||
<node id="600010" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.1" lon="-80.1" />
|
||||
<node id="600011" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.0" lon="-80.1" />
|
||||
</node>
|
||||
<node id="6000012" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.9" lon="-80.9">
|
||||
<tag k="amenity" v="charging_station"/>
|
||||
<tag k="name" v="OpenMapTiles Charging Station"/>
|
||||
<tag k="operator" v="OpenMapTiles Charging Station Operator"/>
|
||||
</node>
|
||||
<way id="6000" timestamp="2019-01-01T00:00:00Z" version="1" visible="true">
|
||||
<nd ref="600008" />
|
||||
<nd ref="600009" />
|
||||
<nd ref="600010" />
|
||||
<nd ref="600011" />
|
||||
<nd ref="600008" />
|
||||
<tag k="amenity" v="charging_station"/>
|
||||
<tag k="brand" v="OpenMapTiles Charging Station Brand"/>
|
||||
</way>
|
||||
</osm>
|
||||
|
||||
@ -196,6 +196,20 @@ BEGIN
|
||||
INSERT INTO omt_test_failures VALUES(600, 'import', 'osm_poi_point parcel_locker with name like "OpenMapTiles Parcel Locker PL00%" expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
-- verify that charging stations are imported with correct name which can come from tags like brand or operator and can contain ref
|
||||
SELECT COUNT(*) INTO cnt FROM osm_poi_point
|
||||
WHERE subclass = 'charging_station'
|
||||
AND tags->'name' = 'OpenMapTiles Charging Station';
|
||||
IF cnt <> 2 THEN
|
||||
INSERT INTO omt_test_failures VALUES(600, 'import', 'osm_poi_point charging_station with name "OpenMapTiles Charging Station" expected 2, got ' || cnt);
|
||||
END IF;
|
||||
SELECT COUNT(*) INTO cnt FROM osm_poi_polygon
|
||||
WHERE subclass = 'charging_station'
|
||||
AND tags->'name' = 'OpenMapTiles Charging Station Brand';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(600, 'import', 'osm_poi_polygon charging_station with name "OpenMapTiles Charging Station Brand" expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
END;
|
||||
|
||||
$$
|
||||
|
||||
@ -98,7 +98,7 @@ BEGIN
|
||||
WHERE subclass = 'parcel_locker'
|
||||
AND tags->'name' like 'OpenMapTiles Parcel Locker%';
|
||||
IF cnt <> 2 THEN
|
||||
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point atm with name "OpenMapTiles ATM" expected 2, got ' || cnt);
|
||||
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point atm with name "OpenMapTiles Parcel Locker%" expected 2, got ' || cnt);
|
||||
END IF;
|
||||
SELECT COUNT(*) INTO cnt FROM osm_poi_point
|
||||
WHERE subclass = 'parcel_locker'
|
||||
@ -107,6 +107,26 @@ BEGIN
|
||||
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point parcel_locker with name "Different operator PL001" expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
-- for charging_station
|
||||
SELECT COUNT(*) INTO cnt FROM osm_poi_point
|
||||
WHERE subclass = 'charging_station'
|
||||
AND tags->'name' = 'OpenMapTiles Charging Station';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point charging_station with name "OpenMapTiles Charging Station" expected 1, got ' || cnt);
|
||||
END IF;
|
||||
SELECT COUNT(*) INTO cnt FROM osm_poi_point
|
||||
WHERE subclass = 'charging_station'
|
||||
AND tags->'name' = 'OpenMapTiles Charging Station Brand';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point charging_station with name "OpenMapTiles Charging Station Brand" expected 1, got ' || cnt);
|
||||
END IF;
|
||||
SELECT COUNT(*) INTO cnt FROM osm_poi_polygon
|
||||
WHERE subclass = 'charging_station'
|
||||
AND tags->'name' = 'OpenMapTiles Charging Station';
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_polygon charging_station with name "OpenMapTiles Charging Station" expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
END;
|
||||
|
||||
$$;
|
||||
|
||||
@ -15,5 +15,18 @@
|
||||
<tag k="brand" v="Different operator"/>
|
||||
<tag k="ref" v="PL001"/>
|
||||
</node>
|
||||
<node id="600007" visible="true" timestamp="2020-01-02T00:00:00Z" version="1" lat="35.8" lon="-80.8">
|
||||
<tag k="amenity" v="charging_station"/>
|
||||
<tag k="brand" v="OpenMapTiles Charging Station Brand"/>
|
||||
</node>
|
||||
<way id="6000" timestamp="2020-01-02T00:00:00Z" version="1" visible="true">
|
||||
<nd ref="600008" />
|
||||
<nd ref="600009" />
|
||||
<nd ref="600010" />
|
||||
<nd ref="600011" />
|
||||
<nd ref="600008" />
|
||||
<tag k="amenity" v="charging_station"/>
|
||||
<tag k="name" v="OpenMapTiles Charging Station"/>
|
||||
</way>
|
||||
</modify>
|
||||
</osmChange>
|
||||
|
||||