Compare commits
49 Commits
1e2c0ea976
...
cd5a2880e0
| Author | SHA1 | Date | |
|---|---|---|---|
| cd5a2880e0 | |||
| 592e7f3c39 | |||
| c38c7af17d | |||
|
|
f70ae783b2 | ||
|
|
e6a1000155 | ||
|
|
d32d74aaac | ||
|
|
22cd373f66 | ||
|
|
7cf98a6293 | ||
|
|
4ed70ba4af | ||
|
|
e6a6fb9453 | ||
| 88dd860053 | |||
| 91ec87bb49 | |||
| d5e05f07d4 | |||
| 7a239b66cf | |||
| 2a39e1ebfe | |||
| 1d39075f03 | |||
| df3f592513 | |||
| 14238e9863 | |||
| c121c69a66 | |||
| 3dd9ccb551 | |||
| 52c91af85c | |||
| d6485e7dd5 | |||
|
|
fe4ea645e9 | ||
| 08e4e8b0bb | |||
| b5b34e1d09 | |||
| 323e0dc8f6 | |||
| c030eaa7be | |||
| c092dd360c | |||
| bd1325109a | |||
| 277829f9a0 | |||
| cbe2ef41c4 | |||
| 58ce31b809 | |||
| 0ee30f3840 | |||
| f3b680e143 | |||
| 029d755ea1 | |||
| 1915af7542 | |||
| 6782ed5f63 | |||
| d638b3ef17 | |||
| 58d997b3ea | |||
| c3cb7ef43f | |||
| bcb1c905c7 | |||
| 0b18f340ae | |||
| 3994345d27 | |||
| 566f4c47d5 | |||
| 7519c5889f | |||
| 0cee7fd6fc | |||
| 5208f1adbd | |||
| 79d5f801d2 | |||
| 27984a8722 |
29
.env
29
.env
@ -16,11 +16,13 @@ PGPORT=5432
|
||||
# BBOX may get overwritten by the computed bbox of the specific area:
|
||||
# make generate-bbox-file
|
||||
# By default, the Makefile will use the content of data/$(area).bbox file if it exists.
|
||||
BBOX=-180.0,-85.0511,180.0,85.0511
|
||||
#BBOX=4.964926,50.882471,5.411252,51.071236
|
||||
#BBOX=4.964926,50.882471,5.411252,51.071236
|
||||
|
||||
|
||||
# Which zooms to generate with make generate-tiles-pg
|
||||
MIN_ZOOM=0
|
||||
MAX_ZOOM=7
|
||||
MAX_ZOOM=16
|
||||
|
||||
# `MID_ZOOM` setting only works with `make generate-tiles-pg` command. Make sure MID_ZOOM < MAX_ZOOM.
|
||||
# See https://github.com/openmaptiles/openmaptiles-tools/pull/383
|
||||
@ -38,9 +40,28 @@ IMPOSM_CONFIG_FILE=/usr/src/app/config/repl_config.json
|
||||
|
||||
# Number of parallel processes to use when importing sql files
|
||||
MAX_PARALLEL_PSQL=5
|
||||
#MAX_PARALLEL_PSQL=16
|
||||
|
||||
# Number of parallel threads to use when generating vector map tiles
|
||||
COPY_CONCURRENCY=10
|
||||
# Number of concurrent IO ops to use when generating vector map tiles
|
||||
# Set to ridiculous high values for SSD/NVME
|
||||
# Test results: (These were without setting UV_THREADPOOL_SIZE)
|
||||
# 64: ~100/s peak
|
||||
# 256: ~200/s peak, stabilizes to a 50% improvement over 64 concurrency
|
||||
# 1024: ~400/s peak, still at 400/s speed after a few minutes (unlike before, oddly enough)
|
||||
# 4096: ~250/s peak, stabilizes to 200. But it appears to be choking on something, only updates progress periodically
|
||||
# 1024 & 24 Threads: ~700/s peak - drops to 214s after 10mins, 178/s after 15mins. EST after 20min: 23hours
|
||||
# Postgres is mainly idle during all of this (coarse dataset), using only half a core
|
||||
# To be tested if 1 core is dedicated to postgres and the others to tilelive(UV_THREADPOOL_SIZE)
|
||||
# will prove to be more efficient on average. Or just UV_THREADPOOL_SIZE==CPU_THREADS.
|
||||
#COPY_CONCURRENCY=10
|
||||
COPY_CONCURRENCY=64
|
||||
#COPY_CONCURRENCY=256
|
||||
#COPY_CONCURRENCY=512
|
||||
#COPY_CONCURRENCY=1024
|
||||
#COPY_CONCURRENCY=4096
|
||||
|
||||
#UV_THREADPOOL_SIZE=16
|
||||
#UV_THREADPOOL_SIZE=24
|
||||
|
||||
# Variables for generate tiles using tilelive-pgquery
|
||||
PGHOSTS_LIST=
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@ quickstart.log
|
||||
|
||||
# imput / output data
|
||||
data/*
|
||||
data.backup/*
|
||||
|
||||
# generated source files
|
||||
build/*
|
||||
|
||||
15
MIEL-open-issues.md
Normal file
15
MIEL-open-issues.md
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
#### amenity: parking_entrance
|
||||
is nog niet covered:
|
||||
https://www.openstreetmap.org/node/3192139608
|
||||
http://localhost:8080/styles/light/?vector#18.53/50.8813949/4.707086
|
||||
|
||||
### While we're at it, add trees
|
||||
As a near-max zoom level thing only.
|
||||
https://www.openstreetmap.org/node/3192142615
|
||||
Would need to be a new layer to style correctly,
|
||||
and other such 'decorations' could be considered.
|
||||
(currently, bins, park-benches, etc are considered regular POI while these
|
||||
would fit in their own 'low-rank' category)
|
||||
|
||||

|
||||
14
Makefile
14
Makefile
@ -13,6 +13,9 @@ TILESET_FILE := $(or $(TILESET_FILE),$(shell (. .env; echo $${TILESET_FILE})),op
|
||||
# Containers run as the current user rather than root (so that created files are not root-owned)
|
||||
DC_OPTS ?= --rm --user=$(shell id -u):$(shell id -g)
|
||||
|
||||
DC_USER?=openmaptiles
|
||||
DC_PASSWORD?=openmaptiles
|
||||
|
||||
# If set to a non-empty value, will use postgis-preloaded instead of postgis docker image
|
||||
USE_PRELOADED_IMAGE ?=
|
||||
|
||||
@ -20,7 +23,7 @@ USE_PRELOADED_IMAGE ?=
|
||||
PPORT ?= 8090
|
||||
export PPORT
|
||||
# Local port to use with tileserver
|
||||
TPORT ?= 8080
|
||||
TPORT ?= 8081
|
||||
export TPORT
|
||||
STYLE_FILE := build/style/style.json
|
||||
STYLE_HEADER_FILE := style/style-header.json
|
||||
@ -274,6 +277,7 @@ build/openmaptiles.tm2source/data.yml: init-dirs
|
||||
ifeq (,$(wildcard build/openmaptiles.tm2source/data.yml))
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c \
|
||||
'generate-tm2source $(TILESET_FILE) > $@'
|
||||
#OLD: $(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools generate-tm2source $(TILESET_FILE) --host="postgres" --port=5432 --database="openmaptiles" --user="$(DC_USER)" --password="$(DC_PASSWORD)" > $@
|
||||
endif
|
||||
|
||||
build/mapping.yaml: init-dirs
|
||||
@ -454,6 +458,12 @@ import-sql: all start-db-nowait
|
||||
awk -v s=": WARNING:" '1{print; fflush()} $$0~s{print "\n*** WARNING detected, aborting"; exit(1)}' | \
|
||||
awk '1{print; fflush()} $$0~".*ERROR" {txt=$$0} END{ if(txt){print "\n*** ERROR detected, aborting:"; print txt; exit(1)} }'
|
||||
|
||||
.PHONY: merge-pbf
|
||||
merge-pbf:
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools \
|
||||
osmosis --rb data/belgium.osm.pbf --rb data/netherlands.osm.pbf --merge --wb data/merges.osm.pbf
|
||||
|
||||
|
||||
.PHONY: generate-tiles
|
||||
generate-tiles: all start-db
|
||||
@echo "WARNING: This Mapnik-based method of tile generation is obsolete. Use generate-tiles-pg instead."
|
||||
@ -596,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
|
||||
|
||||
@ -380,7 +380,7 @@ and the generated maps are going to be available in browser on [localhost:8090/t
|
||||
|
||||
start:
|
||||
* ` make start-tileserver`
|
||||
and the generated maps are going to be available in webbrowser on [localhost:8080](http://localhost:8080/).
|
||||
and the generated maps are going to be available in webbrowser on [localhost:8081](http://localhost:8081/).
|
||||
|
||||
This is only a quick preview, because your mbtiles only generated to zoom level 7 !
|
||||
|
||||
@ -426,7 +426,7 @@ Hints for designers:
|
||||
make stop-maputnik # stop Maputnik Editor + dynamic tile server
|
||||
make start-postserve # start dynamic tile server [ see http://localhost:8090 ]
|
||||
make stop-postserve # stop dynamic tile server
|
||||
make start-tileserver # start maptiler/tileserver-gl [ see http://localhost:8080 ]
|
||||
make start-tileserver # start maptiler/tileserver-gl [ see http://localhost:8081 ]
|
||||
make stop-tileserver # stop maptiler/tileserver-gl
|
||||
|
||||
Hints for developers:
|
||||
|
||||
322
benelux.sh
Executable file
322
benelux.sh
Executable file
@ -0,0 +1,322 @@
|
||||
#!/bin/bash
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
|
||||
###########################################
|
||||
# This file is a modified quickstart.sh, intended to load benelux region
|
||||
#
|
||||
|
||||
# If --empty is not given, use preloaded docker image to speed up
|
||||
if [ $# -gt 0 ] && [[ $1 == --empty ]]; then
|
||||
export USE_PRELOADED_IMAGE=""
|
||||
shift
|
||||
else
|
||||
export USE_PRELOADED_IMAGE=true
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
# default test area
|
||||
export area=belgium
|
||||
echo "No parameter - set area=$area "
|
||||
else
|
||||
export area=$1
|
||||
fi
|
||||
|
||||
if [ $# -eq 2 ]; then
|
||||
osm_server=$2
|
||||
fi
|
||||
|
||||
## Min versions ...
|
||||
MIN_COMPOSE_VER=1.7.1
|
||||
MIN_DOCKER_VER=1.12.3
|
||||
STARTTIME=$(date +%s)
|
||||
STARTDATE=$(date +"%Y-%m-%dT%H:%M%z")
|
||||
|
||||
log_file=./quickstart.log
|
||||
rm -f $log_file
|
||||
echo " "
|
||||
echo "====================================================================================="
|
||||
echo " Docker check & Download images "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Please check the Docker and docker-compose version!"
|
||||
echo " : We are using docker-compose v2 file format! see more at https://docs.docker.com/"
|
||||
echo " : Minimum required Docker version: $MIN_DOCKER_VER+"
|
||||
echo " : Minimum required docker-compose version: $MIN_COMPOSE_VER+"
|
||||
echo " : See the .travis build for the currently supported versions."
|
||||
echo " : Your docker system:"
|
||||
docker --version
|
||||
docker-compose --version
|
||||
|
||||
# based on: http://stackoverflow.com/questions/16989598/bash-comparing-version-numbers
|
||||
function version { echo "$@" | tr -cs '0-9.' '.' | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }'; }
|
||||
|
||||
COMPOSE_VER=$(docker-compose version --short)
|
||||
if [ "$(version "$COMPOSE_VER")" -lt "$(version "$MIN_COMPOSE_VER")" ]; then
|
||||
echo "ERR: Your Docker-compose version is known to have bugs, please update docker-compose!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DOCKER_VER="$(docker -v | awk -F '[ ,]+' '{ print $3 }')"
|
||||
if [ "$(version "$DOCKER_VER")" -lt "$(version "$MIN_DOCKER_VER")" ]; then
|
||||
echo "ERR: Your Docker version is not compatible. Please Update docker!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Pulling or refreshing OpenMapTiles docker images "
|
||||
make refresh-docker-images
|
||||
|
||||
|
||||
##### backup log from here ...
|
||||
exec &> >(tee -a "$log_file")
|
||||
|
||||
echo " "
|
||||
echo "====================================================================================="
|
||||
echo " Start processing "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : OpenMapTiles quickstart! [ https://github.com/openmaptiles/openmaptiles ] "
|
||||
echo " : This will be logged to the $log_file file (for debugging) and to the screen"
|
||||
echo " : Area : $area "
|
||||
echo " : Download server : ${osm_server:-unset (automatic)} "
|
||||
echo " : Preloaded image : $USE_PRELOADED_IMAGE "
|
||||
echo " : Git version : $(git rev-parse HEAD) "
|
||||
echo " : Started : $STARTDATE "
|
||||
echo " : Your bash version: $BASH_VERSION"
|
||||
echo " : Your OS : $OSTYPE"
|
||||
docker --version
|
||||
docker-compose --version
|
||||
|
||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo " : This is working on x86_64 ; Your kernel is:"
|
||||
uname -r
|
||||
uname -m
|
||||
|
||||
KERNEL_CPU_VER=$(uname -m)
|
||||
if [ "$KERNEL_CPU_VER" != "x86_64" ]; then
|
||||
echo "ERR: Sorry this is working only on x86_64!"
|
||||
exit 1
|
||||
fi
|
||||
echo " : --- Memory, CPU info ---- "
|
||||
mem=$( grep MemTotal /proc/meminfo | awk '{print $2}' | xargs -I {} echo "scale=4; {}/1024^2" | bc )
|
||||
echo "System memory (GB): ${mem}"
|
||||
grep SwapTotal /proc/meminfo
|
||||
echo "CPU number: $(grep -c processor /proc/cpuinfo) x $(grep "bogomips" /proc/cpuinfo | head -1)"
|
||||
grep Free /proc/meminfo
|
||||
else
|
||||
echo " "
|
||||
echo "Warning : Platforms other than Linux are less tested"
|
||||
echo " "
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Stopping running services & removing old containers"
|
||||
make destroy-db
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Existing OpenMapTiles docker images. Will use version $(source .env && echo "$TOOLS_VERSION")"
|
||||
docker images | grep openmaptiles
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Create directories if they don't exist"
|
||||
make init-dirs
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Removing old MBTILES if exists ( ./data/${area}.mbtiles ) "
|
||||
rm -f "./data/${area}.mbtiles"
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Downloading ${area} from ${osm_server:-any source}..."
|
||||
make "download${osm_server:+-${osm_server}}"
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Remove old generated source files ( ./build/* ) ( if they exist ) "
|
||||
make clean
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Code generating from the layer definitions ( ./build/mapping.yaml; ./build/sql/* )"
|
||||
echo " : The tool source code: https://github.com/openmaptiles/openmaptiles-tools "
|
||||
echo " : But we generate the tm2source, Imposm mappings and SQL functions from the layer definitions! "
|
||||
make all
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
if [[ "$USE_PRELOADED_IMAGE" == true ]]; then
|
||||
echo "====> : Start PostgreSQL service using postgis image preloaded with this data:"
|
||||
echo " : * Water data from http://osmdata.openstreetmap.de"
|
||||
echo " : Data license: https://osmdata.openstreetmap.de/info/license.html"
|
||||
echo " : * Natural Earth from http://www.naturalearthdata.com"
|
||||
echo " : Terms-of-use: http://www.naturalearthdata.com/about/terms-of-use"
|
||||
echo " : * OpenStreetMap Lakelines data https://github.com/lukasmartinelli/osm-lakelines"
|
||||
echo " :"
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-data"
|
||||
echo " : includes all data from the import-data image"
|
||||
echo " :"
|
||||
echo " : Use the --empty flag to start with an empty database:"
|
||||
echo " : ./quickstart.sh --empty albania "
|
||||
echo " : If desired, you can manually import data by using these commands:"
|
||||
echo " : make destroy-db"
|
||||
echo " : make start-db"
|
||||
echo " : make import-data"
|
||||
echo " :"
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/postgis-preloaded"
|
||||
echo " : Thank you https://www.postgresql.org ! Thank you http://postgis.org !"
|
||||
make start-db-preloaded
|
||||
else
|
||||
echo "====> : Start PostgreSQL service using empty database and importing all the data:"
|
||||
echo " : * Water data from http://osmdata.openstreetmap.de"
|
||||
echo " : Data license: https://osmdata.openstreetmap.de/info/license.html"
|
||||
echo " : * Natural Earth from http://www.naturalearthdata.com"
|
||||
echo " : Terms-of-use: http://www.naturalearthdata.com/about/terms-of-use"
|
||||
echo " : * OpenStreetMap Lakelines data https://github.com/lukasmartinelli/osm-lakelines"
|
||||
echo " :"
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-data"
|
||||
echo " : includes all data from the import-data image"
|
||||
echo " :"
|
||||
echo " : Thank you https://www.postgresql.org ! Thank you http://postgis.org !"
|
||||
make start-db
|
||||
make import-data
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Start importing OpenStreetMap data: ${area} -> imposm3[./build/mapping.yaml] -> PostgreSQL"
|
||||
echo " : Imposm3 documentation: https://imposm.org/docs/imposm3/latest/index.html "
|
||||
echo " : Thank you Omniscale! "
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-osm "
|
||||
echo " : The OpenstreetMap data license: https://www.openstreetmap.org/copyright (ODBL) "
|
||||
echo " : Thank you OpenStreetMap Contributors ! "
|
||||
make import-osm
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Start importing border ${area} data into PostgreSQL using osmborder"
|
||||
echo " : Source code: https://github.com/pnorman/osmborder"
|
||||
echo " : Data license: http://www.openstreetmap.org/copyright"
|
||||
echo " : Thank you Paul Norman"
|
||||
make import-borders
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Start importing Wikidata: Wikidata Query Service -> PostgreSQL"
|
||||
echo " : The Wikidata license: CC0 - https://www.wikidata.org/wiki/Wikidata:Main_Page "
|
||||
echo " : Thank you Wikidata Contributors ! "
|
||||
make import-wikidata
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Start SQL postprocessing: ./build/sql/* -> PostgreSQL "
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/blob/master/bin/import-sql"
|
||||
# If the output contains a WARNING, stop further processing
|
||||
# Adapted from https://unix.stackexchange.com/questions/307562
|
||||
make import-sql
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Analyze PostgreSQL tables"
|
||||
make analyze-db
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Testing PostgreSQL tables to match layer definitions metadata"
|
||||
make test-perf-null
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
|
||||
if [[ "$(source .env ; echo "$BBOX")" = "-180.0,-85.0511,180.0,85.0511" ]]; then
|
||||
if [[ "$area" != "planet" ]]; then
|
||||
echo "====> : Compute bounding box for tile generation"
|
||||
make generate-bbox-file ${MIN_ZOOM:+MIN_ZOOM="${MIN_ZOOM}"} ${MAX_ZOOM:+MAX_ZOOM="${MAX_ZOOM}"}
|
||||
else
|
||||
echo "====> : Skipping bbox calculation when generating the entire planet"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "====> : Bounding box is set in .env file"
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Start generating MBTiles (containing gzipped MVT PBF) from a TM2Source project. "
|
||||
echo " : TM2Source project definitions : ./build/openmaptiles.tm2source/data.yml "
|
||||
echo " : Output MBTiles: ./data/${area}.mbtiles "
|
||||
echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/generate-vectortiles "
|
||||
echo " : We are using a lot of Mapbox Open Source tools! : https://github.com/mapbox "
|
||||
echo " : Thank you https://www.mapbox.com !"
|
||||
echo " : See other MVT tools : https://github.com/mapbox/awesome-vector-tiles "
|
||||
echo " : "
|
||||
echo " : You will see a lot of deprecated warning in the log! This is normal! "
|
||||
echo " : like : Mapnik LOG> ... is deprecated and will be removed in Mapnik 4.x ... "
|
||||
make generate-tiles
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Stop PostgreSQL service ( but we keep PostgreSQL data volume for debugging )"
|
||||
make stop-db
|
||||
|
||||
echo " "
|
||||
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
|
||||
} >> ./data/quickstart_checklist.chk
|
||||
cat ./data/quickstart_checklist.chk
|
||||
|
||||
ENDTIME=$(date +%s)
|
||||
|
||||
echo " "
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "-- S u m m a r y --"
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : (disk space) We have created a lot of docker images: "
|
||||
echo " : Hint: you can remove with: docker rmi IMAGE "
|
||||
docker images | grep openmaptiles
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : (disk space) We have created the new vectortiles ( ./data/${area}.mbtiles ) "
|
||||
echo " : Please respect the licenses (OdBL for OSM data) of the sources when distributing the MBTiles file."
|
||||
echo " : Data directory content:"
|
||||
ls -la ./data
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "The ./quickstart.sh $area is finished! "
|
||||
echo "It took $((ENDTIME - STARTTIME)) seconds to complete"
|
||||
echo "We saved the log file to $log_file (for debugging) You can compare with the travis log !"
|
||||
echo " "
|
||||
echo "Start experimenting and check the QUICKSTART.MD file!"
|
||||
echo " "
|
||||
echo "* Use make start-maputnik to explore tile generation on request"
|
||||
echo "* Use make start-tileserver to view pre-generated tiles"
|
||||
echo " "
|
||||
echo "Available help commands (make help) "
|
||||
make help
|
||||
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
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 " © OpenMapTiles © OpenStreetMap contributors "
|
||||
echo " "
|
||||
echo " Thanks to all free, open source software developers and Open Data Contributors! "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
46
cerxes-maps-belgium.sh
Executable file
46
cerxes-maps-belgium.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Test script for generating tiles for Lummen and region (e.g. including Hasselt)
|
||||
export SOURCE=osmfr
|
||||
export AREA=europe/belgium
|
||||
export BBOX=2.255544,49.857797,6.586904,51.389246
|
||||
# Which zooms to generate in make generate-tiles
|
||||
export MIN_ZOOM=0
|
||||
export MAX_ZOOM=16
|
||||
|
||||
# Update the .env to match
|
||||
sed -i "s/MIN_ZOOM=.*/MIN_ZOOM=${MIN_ZOOM}/" .env
|
||||
sed -i "s/MAX_ZOOM=.*/MAX_ZOOM=${MAX_ZOOM}/" .env
|
||||
sed -i "s/BBOX=.*/BBOX=${BBOX}/" .env
|
||||
|
||||
|
||||
# Setup
|
||||
make clean
|
||||
make DC_OPTS=--rm
|
||||
|
||||
# Start from a clean db
|
||||
make start-db
|
||||
make destroy-db
|
||||
make import-data
|
||||
# ALTERNATIVE would be this
|
||||
#make start-db-preloaded
|
||||
|
||||
# Download
|
||||
make download-${SOURCE} area="${AREA}"
|
||||
|
||||
# Import (yes we're doing import borders twice, it crashes on first run, oddly enough)
|
||||
make import-osm
|
||||
make import-wikidata
|
||||
make import-borders || true
|
||||
make import-sql
|
||||
make analyze-db
|
||||
|
||||
# (This potentially screws stuff up?!)
|
||||
#rm -rf data/${AREA}.dc-config.yml
|
||||
#make generate-dc-config
|
||||
|
||||
# Generate
|
||||
make generate-tiles-pg
|
||||
|
||||
make stop-db
|
||||
46
cerxes-maps.sh
Executable file
46
cerxes-maps.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Script for generating tiles for what cerxes server should host
|
||||
export SOURCE=geofabrik
|
||||
export AREA=europe
|
||||
export BBOX=-4.382176,47.705913,13.053127,53.803762
|
||||
# Which zooms to generate in make generate-tiles
|
||||
export MIN_ZOOM=0
|
||||
export MAX_ZOOM=16
|
||||
|
||||
# Update the .env to match
|
||||
sed -i "s/MIN_ZOOM=.*/MIN_ZOOM=${MIN_ZOOM}/" .env
|
||||
sed -i "s/MAX_ZOOM=.*/MAX_ZOOM=${MAX_ZOOM}/" .env
|
||||
sed -i "s/BBOX=.*/BBOX=${BBOX}/" .env
|
||||
|
||||
|
||||
# Setup
|
||||
make clean
|
||||
make DC_OPTS=--rm
|
||||
|
||||
# Start from a clean db
|
||||
make start-db
|
||||
make destroy-db
|
||||
make import-data
|
||||
# ALTERNATIVE would be this
|
||||
#make start-db-preloaded
|
||||
|
||||
# Download
|
||||
make download-${SOURCE} area="${AREA}"
|
||||
|
||||
# Import (yes we're doing import borders twice, it crashes on first run, oddly enough)
|
||||
make import-osm
|
||||
make import-wikidata
|
||||
make import-borders || true
|
||||
make import-sql
|
||||
make analyze-db
|
||||
|
||||
# (This potentially screws stuff up?!)
|
||||
#rm -rf data/${AREA}.dc-config.yml
|
||||
#make generate-dc-config
|
||||
|
||||
# Generate
|
||||
make generate-tiles-pg
|
||||
|
||||
make stop-db
|
||||
@ -12,6 +12,7 @@ services:
|
||||
|
||||
postgres:
|
||||
image: "${POSTGIS_IMAGE:-openmaptiles/postgis}:${TOOLS_VERSION}"
|
||||
# image: harbor.cerxes.net/openmaptiles/postgis:5.3
|
||||
# Use "command: postgres -c jit=off" for PostgreSQL 11+ because of slow large MVT query processing
|
||||
# Use "shm_size: 512m" if you want to prevent a possible 'No space left on device' during 'make generate-tiles-pg'
|
||||
volumes:
|
||||
@ -27,6 +28,9 @@ services:
|
||||
POSTGRES_USER: ${PGUSER:-openmaptiles}
|
||||
POSTGRES_PASSWORD: ${PGPASSWORD:-openmaptiles}
|
||||
PGPORT: ${PGPORT:-5432}
|
||||
shm_size: 16384MB
|
||||
#command: /docker-entrypoint-initdb.d/01_tune-postgis.sh
|
||||
#command: /docker-entrypoint-initdb.d/01_tune-postgis.sh && echo 'tuned' && postgres -c 'config_file=/etc/postgresql/postgresql.conf'
|
||||
|
||||
import-data:
|
||||
image: "openmaptiles/import-data:${TOOLS_VERSION}"
|
||||
|
||||
150
europe.sh
Executable file
150
europe.sh
Executable file
@ -0,0 +1,150 @@
|
||||
set -e
|
||||
|
||||
#area=europe
|
||||
area=planet
|
||||
|
||||
make refresh-docker-images
|
||||
|
||||
# Show mem info
|
||||
mem=$( grep MemTotal /proc/meminfo | awk '{print $2}' | xargs -I {} echo "scale=4; {}/1024^2" | bc )
|
||||
echo "System memory (GB): ${mem}"
|
||||
grep SwapTotal /proc/meminfo
|
||||
echo "CPU number: $(grep -c processor /proc/cpuinfo) x $(grep "bogomips" /proc/cpuinfo | head -1)"
|
||||
grep Free /proc/meminfo
|
||||
|
||||
|
||||
make destroy-db
|
||||
make init-dirs
|
||||
|
||||
# rm -f "./data/${area}.mbtiles"
|
||||
#echo "====> : Downloading ${area} from ${osm_server:-any source}..."
|
||||
#area=$area make "download${osm_server:+-${osm_server}}"
|
||||
|
||||
make clean
|
||||
make all
|
||||
|
||||
make start-db
|
||||
make import-data
|
||||
|
||||
# about 1.25hrs, Presumably Disk IO limited.
|
||||
# If there is an option to double the amount of processes this might
|
||||
# also help. Seeing about 50% usage per core
|
||||
# [May 21 08:52:53] [INFO] Reading OSM data took: 22m9.040318577s
|
||||
# [May 21 09:42:37] [INFO] Writing OSM data took: 49m44.555518107s
|
||||
# [May 21 09:45:15] [INFO] Importing OSM data took: 52m21.813870474s
|
||||
# [May 21 09:45:15] [INFO] [PostGIS] Rotating tables took: 38.69062ms
|
||||
# [May 21 09:45:15] [INFO] Imposm took: 1h14m30.893125729s
|
||||
make import-osm area=$area
|
||||
|
||||
make import-borders area=$area
|
||||
|
||||
|
||||
make import-wikidata
|
||||
|
||||
# It not doing the materialized view in parallel despite postgres 12?!
|
||||
# argh
|
||||
make import-sql
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Analyze PostgreSQL tables"
|
||||
make analyze-db
|
||||
|
||||
echo " "
|
||||
echo "-------------------------------------------------------------------------------------"
|
||||
echo "====> : Testing PostgreSQL tables to match layer definitions metadata"
|
||||
# TODO: this right here shows us whats wrong. settings aren't optimal (see performance tips tabs)
|
||||
# shared_buffersm work_mem, max_worker_processes,
|
||||
# TODO, Ideal solution: Autoconfigure according to performance tips (and max_worker_processes == HT Cores ( or 1.5X HT Cores)
|
||||
# (1.5x HT Cores might make sense as most work is probably memory-limited (latency), not CPU limited)
|
||||
make test-perf-null
|
||||
|
||||
#echo " "
|
||||
#echo "-------------------------------------------------------------------------------------"
|
||||
#
|
||||
#if [[ "$(source .env ; echo "$BBOX")" = "-180.0,-85.0511,180.0,85.0511" ]]; then
|
||||
# if [[ "$area" != "planet" ]]; then
|
||||
# echo "====> : Compute bounding box for tile generation"
|
||||
# make generate-bbox-file ${MIN_ZOOM:+MIN_ZOOM="${MIN_ZOOM}"} ${MAX_ZOOM:+MAX_ZOOM="${MAX_ZOOM}"}
|
||||
# else
|
||||
# echo "====> : Skipping bbox calculation when generating the entire planet"
|
||||
# fi
|
||||
#
|
||||
#else
|
||||
# echo "====> : Bounding box is set in .env file"
|
||||
#fi
|
||||
#
|
||||
##echo " "
|
||||
##echo "-------------------------------------------------------------------------------------"
|
||||
##echo "====> : Start generating MBTiles (containing gzipped MVT PBF) from a TM2Source project. "
|
||||
##echo " : TM2Source project definitions : ./build/openmaptiles.tm2source/data.yml "
|
||||
##echo " : Output MBTiles: ./data/${area}.mbtiles "
|
||||
##echo " : Source code: https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/generate-vectortiles "
|
||||
##echo " : We are using a lot of Mapbox Open Source tools! : https://github.com/mapbox "
|
||||
##echo " : Thank you https://www.mapbox.com !"
|
||||
##echo " : See other MVT tools : https://github.com/mapbox/awesome-vector-tiles "
|
||||
##echo " : "
|
||||
##echo " : You will see a lot of deprecated warning in the log! This is normal! "
|
||||
##echo " : like : Mapnik LOG> ... is deprecated and will be removed in Mapnik 4.x ... "
|
||||
make generate-tiles area=europe
|
||||
#OVERLAY
|
||||
##
|
||||
##echo " "
|
||||
##echo "-------------------------------------------------------------------------------------"
|
||||
##echo "====> : Stop PostgreSQL service ( but we keep PostgreSQL data volume for debugging )"
|
||||
##make stop-db
|
||||
##
|
||||
##echo " "
|
||||
##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
|
||||
##} >> ./data/quickstart_checklist.chk
|
||||
##cat ./data/quickstart_checklist.chk
|
||||
##
|
||||
##ENDTIME=$(date +%s)
|
||||
##
|
||||
##echo " "
|
||||
##echo " "
|
||||
##echo "-------------------------------------------------------------------------------------"
|
||||
##echo "-- S u m m a r y --"
|
||||
##echo "-------------------------------------------------------------------------------------"
|
||||
##echo " "
|
||||
##echo "-------------------------------------------------------------------------------------"
|
||||
##echo "====> : (disk space) We have created a lot of docker images: "
|
||||
##echo " : Hint: you can remove with: docker rmi IMAGE "
|
||||
##docker images | grep openmaptiles
|
||||
##
|
||||
##echo " "
|
||||
##echo "-------------------------------------------------------------------------------------"
|
||||
##echo "====> : (disk space) We have created the new vectortiles ( ./data/${area}.mbtiles ) "
|
||||
##echo " : Please respect the licenses (OdBL for OSM data) of the sources when distributing the MBTiles file."
|
||||
##echo " : Data directory content:"
|
||||
##ls -la ./data
|
||||
##
|
||||
##echo " "
|
||||
##echo "-------------------------------------------------------------------------------------"
|
||||
##echo "The ./quickstart.sh $area is finished! "
|
||||
##echo "It took $((ENDTIME - STARTTIME)) seconds to complete"
|
||||
##echo "We saved the log file to $log_file (for debugging) You can compare with the travis log !"
|
||||
##echo " "
|
||||
##echo "Start experimenting and check the QUICKSTART.MD file!"
|
||||
##echo " "
|
||||
##echo "* Use make start-maputnik to explore tile generation on request"
|
||||
##echo "* Use make start-tileserver to view pre-generated tiles"
|
||||
##echo " "
|
||||
##echo "Available help commands (make help) "
|
||||
##make help
|
||||
##
|
||||
##echo "-------------------------------------------------------------------------------------"
|
||||
##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 " © OpenMapTiles © OpenStreetMap contributors "
|
||||
##echo " "
|
||||
##echo " Thanks to all free, open source software developers and Open Data Contributors! "
|
||||
##echo "-------------------------------------------------------------------------------------"
|
||||
@ -63,7 +63,7 @@
|
||||
"iata"
|
||||
]
|
||||
],
|
||||
"order": 190
|
||||
"order": 185
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -157,7 +157,7 @@
|
||||
"taxiway"
|
||||
]
|
||||
],
|
||||
"order": 191
|
||||
"order": 186
|
||||
},
|
||||
{
|
||||
"id": "airport_gate",
|
||||
@ -197,7 +197,7 @@
|
||||
"gate"
|
||||
]
|
||||
],
|
||||
"order": 192
|
||||
"order": 187
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -116,6 +116,12 @@ tables:
|
||||
name: maritime
|
||||
type: bool
|
||||
from_member: true
|
||||
- name: index
|
||||
type: member_index
|
||||
- name: role
|
||||
type: member_role
|
||||
# - name: type
|
||||
# type: member_type
|
||||
- key: boundary_type
|
||||
name: boundary_type
|
||||
type: string
|
||||
@ -127,11 +133,11 @@ tables:
|
||||
relation_types: [boundary]
|
||||
mapping:
|
||||
boundary:
|
||||
- administrative
|
||||
- administrative
|
||||
border_status:
|
||||
- dispute
|
||||
- dispute
|
||||
boundary_type:
|
||||
- maritime
|
||||
- maritime
|
||||
|
||||
# etldoc: imposm3 -> osm_boundary_polygon
|
||||
boundary_polygon:
|
||||
@ -158,3 +164,128 @@ tables:
|
||||
mapping:
|
||||
boundary:
|
||||
- aboriginal_lands
|
||||
|
||||
|
||||
# etldoc: imposm3 -> osm_border_disp_relation
|
||||
border_disp_relation:
|
||||
type: relation_member
|
||||
columns:
|
||||
- name: relation_id
|
||||
type: id
|
||||
- name: osm_id
|
||||
type: id
|
||||
from_member: true
|
||||
- name: geometry
|
||||
type: geometry
|
||||
- key: name
|
||||
name: name
|
||||
type: string
|
||||
- key: boundary
|
||||
name: boundary
|
||||
type: string
|
||||
- key: admin_level
|
||||
name: admin_level
|
||||
type: integer
|
||||
- key: claimed_by
|
||||
name: claimed_by
|
||||
type: string
|
||||
- key: disputed_by
|
||||
name: disputed_by
|
||||
type: string
|
||||
- key: maritime
|
||||
name: maritime
|
||||
type: bool
|
||||
from_member: true
|
||||
- name: index
|
||||
type: member_index
|
||||
- name: role
|
||||
type: member_role
|
||||
- name: type
|
||||
type: member_type
|
||||
mapping:
|
||||
type: [boundary]
|
||||
filters:
|
||||
require:
|
||||
#admin_level: ['2'] # this used to be specified, re-enable if bugs show up with country borders
|
||||
admin_level: [__any__]
|
||||
boundary: ['administrative'] # Filters out boundary administrative_fraction and religious_administration
|
||||
|
||||
# FOr NUTS in linestring version
|
||||
administrative_relation:
|
||||
type: relation
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- key: name
|
||||
name: name
|
||||
type: string
|
||||
- name: name_en
|
||||
key: name:en
|
||||
type: string
|
||||
- name: name_nl
|
||||
key: name:nl
|
||||
type: string
|
||||
- name: name_de
|
||||
key: name:de
|
||||
type: string
|
||||
- name: name_fr
|
||||
key: name:fr
|
||||
type: string
|
||||
- key: boundary
|
||||
name: boundary
|
||||
type: string
|
||||
- key: admin_level
|
||||
name: admin_level
|
||||
type: integer
|
||||
mapping:
|
||||
boundary: [ 'administrative' ]
|
||||
filters:
|
||||
require:
|
||||
admin_level: [ __any__ ]
|
||||
|
||||
administrative_member:
|
||||
type: relation_member
|
||||
columns:
|
||||
- name: relation_id
|
||||
type: id
|
||||
- name: boundary_id
|
||||
type: id
|
||||
from_member: true
|
||||
- key: admin_level
|
||||
name: admin_level
|
||||
type: integer
|
||||
- key: maritime
|
||||
name: maritime
|
||||
type: bool
|
||||
from_member: true
|
||||
- name: index
|
||||
type: member_index
|
||||
- name: role
|
||||
type: member_role
|
||||
- name: type
|
||||
type: member_type
|
||||
mapping:
|
||||
type: [boundary]
|
||||
filters:
|
||||
require:
|
||||
admin_level: [__any__]
|
||||
boundary: ['administrative']
|
||||
|
||||
administrative_boundary:
|
||||
type: linestring
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
type: geometry
|
||||
- key: admin_level
|
||||
name: admin_level
|
||||
type: integer
|
||||
- key: maritime
|
||||
name: maritime
|
||||
type: bool
|
||||
mapping:
|
||||
boundary: [ 'administrative' ]
|
||||
filters:
|
||||
require:
|
||||
admin_level: [ __any__ ]
|
||||
193
layers/boundary/nuts.sql
Normal file
193
layers/boundary/nuts.sql
Normal file
@ -0,0 +1,193 @@
|
||||
-- This is very crude and not finetuned yet
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO
|
||||
$$
|
||||
BEGIN
|
||||
DROP TABLE IF EXISTS osm_boundary_polygon_nuts CASCADE;
|
||||
EXCEPTION
|
||||
WHEN wrong_object_type THEN
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen_z13
|
||||
-- etldoc: osm_border_linestring_adm -> osm_border_linestring_gen_z13
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_boundary_polygon_nuts CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_boundary_polygon_nuts AS
|
||||
(
|
||||
SELECT r.osm_id as relation_id,
|
||||
r.name,
|
||||
r.name_en,
|
||||
r.name_nl,
|
||||
r.name_de,
|
||||
r.name_fr,
|
||||
r.admin_level,
|
||||
p.geometry
|
||||
FROM (
|
||||
SELECT relation_id,
|
||||
ST_BuildArea(ST_Node(ST_Collect(geometry))) as geometry
|
||||
FROM osm_border_disp_relation
|
||||
WHERE (role = 'outer' or role = 'inner')
|
||||
AND ST_GeometryType(geometry) = 'ST_LineString'
|
||||
GROUP BY relation_id
|
||||
) as p
|
||||
LEFT JOIN osm_administrative_relation as r on r.osm_id = p.relation_id
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_idx ON osm_boundary_polygon_nuts USING gist (geometry);
|
||||
|
||||
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen_z13
|
||||
-- etldoc: osm_border_linestring_adm -> osm_border_linestring_gen_z13
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_boundary_linestring CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_boundary_linestring AS
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
nuts_level,
|
||||
nuts ->> 'l_nuts_0_name' as l_nuts_0_name,
|
||||
nuts ->> 'l_nuts_1_name' as l_nuts_1_name,
|
||||
nuts ->> 'l_nuts_2_name' as l_nuts_2_name,
|
||||
nuts ->> 'l_nuts_3_name' as l_nuts_3_name,
|
||||
nuts ->> 'l_nuts_4_name' as l_nuts_4_name,
|
||||
nuts ->> 'l_nuts_5_name' as l_nuts_5_name,
|
||||
nuts ->> 'r_nuts_0_name' as r_nuts_0_name,
|
||||
nuts ->> 'r_nuts_1_name' as r_nuts_1_name,
|
||||
nuts ->> 'r_nuts_2_name' as r_nuts_2_name,
|
||||
nuts ->> 'r_nuts_3_name' as r_nuts_3_name,
|
||||
nuts ->> 'r_nuts_4_name' as r_nuts_4_name,
|
||||
nuts ->> 'r_nuts_5_name' as r_nuts_5_name
|
||||
-- Shouldnt be needed for the map
|
||||
-- nuts->'l_nuts_1_id' as l_nuts_1_id,
|
||||
-- nuts->'l_nuts_2_id' as l_nuts_2_id,
|
||||
-- nuts->'l_nuts_3_id' as l_nuts_3_id,
|
||||
-- nuts->'l_nuts_4_id' as l_nuts_4_id,
|
||||
-- nuts->'l_nuts_5_id' as l_nuts_5_id,
|
||||
-- nuts->'r_nuts_1_id' as r_nuts_1_id,
|
||||
-- nuts->'r_nuts_2_id' as r_nuts_2_id,
|
||||
-- nuts->'r_nuts_3_id' as r_nuts_3_id,
|
||||
-- nuts->'r_nuts_4_id' as r_nuts_4_id,
|
||||
-- nuts->'r_nuts_5_id' as r_nuts_5_id
|
||||
FROM (
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
MIN(nuts_level) as nuts_level,
|
||||
jsonb_object_agg(
|
||||
CONCAT(side, '_nuts_', nuts_level, '_name'), name
|
||||
)
|
||||
|| jsonb_object_agg(
|
||||
CONCAT(side, '_nuts_', nuts_level, '_id'), -relation_id
|
||||
) as nuts
|
||||
FROM (
|
||||
SELECT b.osm_id,
|
||||
b.geometry,
|
||||
CASE
|
||||
WHEN r.admin_level = 10 THEN 6
|
||||
WHEN r.admin_level = 9 THEN 5
|
||||
WHEN r.admin_level = 8 THEN 4
|
||||
WHEN r.admin_level = 7 THEN 3
|
||||
WHEN r.admin_level = 6 THEN 2
|
||||
WHEN r.admin_level = 4 THEN 1
|
||||
-- No admin_level =3?
|
||||
WHEN r.admin_level = 2 THEN 0
|
||||
-- All other are stored as low priority NUTS, for future reference
|
||||
ELSE 1000 + r.admin_level
|
||||
END as nuts_level,
|
||||
COALESCE(NULLIF(r.name_en,''), NULLIF(r.name,''), NULL) as name,
|
||||
r.relation_id,
|
||||
CASE
|
||||
WHEN
|
||||
ST_Within(
|
||||
ST_OffsetCurve(
|
||||
(ST_LineSubString(b.geometry, 0.499, 0.501)), 10,
|
||||
'quad_segs=4 join=mitre'
|
||||
),
|
||||
r.geometry
|
||||
)
|
||||
THEN 'r'
|
||||
WHEN
|
||||
ST_Within(
|
||||
ST_OffsetCurve(
|
||||
(ST_LineSubString(b.geometry, 0.499, 0.501)), -10,
|
||||
'quad_segs=4 join=mitre'
|
||||
),
|
||||
r.geometry
|
||||
)
|
||||
THEN 'l'
|
||||
ELSE 'unknown' -- TODO: Debug if this ever happens, if so our method isn't fool proof
|
||||
END as side
|
||||
FROM osm_administrative_boundary as b
|
||||
INNER JOIN osm_administrative_member as m
|
||||
ON b.osm_id = m.boundary_id
|
||||
INNER JOIN osm_boundary_polygon_nuts as r
|
||||
ON m.relation_id = r.relation_id
|
||||
) as g
|
||||
GROUP BY osm_id, geometry
|
||||
) as p /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_linestring_idx ON osm_boundary_linestring USING gist (geometry);
|
||||
|
||||
|
||||
-- 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+"]
|
||||
CREATE OR REPLACE FUNCTION layer_nuts(bbox geometry, zoom_level int)
|
||||
RETURNS TABLE
|
||||
(
|
||||
geometry geometry,
|
||||
nuts_level int,
|
||||
l_nuts_0_name text,
|
||||
l_nuts_1_name text,
|
||||
l_nuts_2_name text,
|
||||
l_nuts_3_name text,
|
||||
l_nuts_4_name text,
|
||||
l_nuts_5_name text,
|
||||
r_nuts_0_name text,
|
||||
r_nuts_1_name text,
|
||||
r_nuts_2_name text,
|
||||
r_nuts_3_name text,
|
||||
r_nuts_4_name text,
|
||||
r_nuts_5_name text
|
||||
)
|
||||
AS
|
||||
$$
|
||||
SELECT geometry,
|
||||
nuts_level,
|
||||
l_nuts_0_name,
|
||||
l_nuts_1_name,
|
||||
l_nuts_2_name,
|
||||
l_nuts_3_name,
|
||||
l_nuts_4_name,
|
||||
l_nuts_5_name,
|
||||
r_nuts_0_name,
|
||||
r_nuts_1_name,
|
||||
r_nuts_2_name,
|
||||
r_nuts_3_name,
|
||||
r_nuts_4_name,
|
||||
r_nuts_5_name
|
||||
FROM osm_boundary_linestring
|
||||
WHERE geometry && bbox
|
||||
AND zoom_level >
|
||||
(CASE
|
||||
WHEN nuts_level = 0 THEN 2
|
||||
WHEN nuts_level = 1 THEN 4
|
||||
WHEN nuts_level = 2 THEN 6
|
||||
WHEN nuts_level = 3 THEN 6
|
||||
WHEN nuts_level = 4 THEN 8
|
||||
WHEN nuts_level = 5 THEN 10
|
||||
END)
|
||||
$$ LANGUAGE SQL STABLE
|
||||
-- STRICT
|
||||
PARALLEL SAFE;
|
||||
|
||||
|
||||
/*
|
||||
r.name,
|
||||
CASE
|
||||
WHEN r.admin_level = 10 THEN 6
|
||||
WHEN r.admin_level = 9 THEN 5
|
||||
WHEN r.admin_level = 8 THEN 4
|
||||
WHEN r.admin_level = 7 THEN 3
|
||||
WHEN r.admin_level = 6 THEN 2
|
||||
WHEN r.admin_level = 4 THEN 1
|
||||
-- No admin_level =3?
|
||||
WHEN r.admin_level = 2 THEN 0
|
||||
ELSE null
|
||||
END as nuts_level,
|
||||
*/
|
||||
49
layers/boundary/nuts.yaml
Normal file
49
layers/boundary/nuts.yaml
Normal file
@ -0,0 +1,49 @@
|
||||
layer:
|
||||
id: "nuts"
|
||||
description: |
|
||||
Contains administrative boundaries as linestrings (municipalities, counties, provinces, ...)
|
||||
Administrative regions are translated to their equivalent NUTS/LAU classification
|
||||
Fields indicate which NUTS-region is to the left and right of the linestring
|
||||
fields:
|
||||
nuts_level:
|
||||
The mininum NUTS/LAU classification this linestring is part of.
|
||||
NUTS only goes to 3 thus LAU 1 & 2 are mapped as NUTS 4 & 5.
|
||||
NUTS 0 = Countries
|
||||
NUTS 1 = Regions (e.g. Vlaams-brabant)
|
||||
NUTS 2 = Provinces (e.g. Limburg)
|
||||
NUTS 3 = Administrative arrondissements (e.g. Antwerpen, best to ignore these)
|
||||
NUTS 4 = Municipalities (e.g. Lummen)
|
||||
NUTS 5 = Villages/Suburbs (e.g. Linkhout)
|
||||
l_nuts_0_name: |
|
||||
Country on the left side of the linestring
|
||||
l_nuts_1_name: |
|
||||
Region on the left side of the linestring
|
||||
l_nuts_2_name: |
|
||||
Province on the left side of the linestring
|
||||
l_nuts_3_name: |
|
||||
Administrative arrondissement on the left side of the linestring
|
||||
l_nuts_4_name: |
|
||||
Municipality on the left side of the linestring
|
||||
l_nuts_5_name: |
|
||||
Village/suburb on the left side of the linestring
|
||||
r_nuts_0_name: |
|
||||
Country on the right side of the linestring
|
||||
r_nuts_1_name: |
|
||||
Region on the right side of the linestring
|
||||
r_nuts_2_name: |
|
||||
Province on the right side of the linestring
|
||||
r_nuts_3_name: |
|
||||
Administrative arrondissement on the right side of the linestring
|
||||
r_nuts_4_name: |
|
||||
Municipality on the right side of the linestring
|
||||
r_nuts_5_name: |
|
||||
Village/suburb on the right side of the linestring
|
||||
buffer_size: 4
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
query: (SELECT geometry, nuts_level, l_nuts_0_name, l_nuts_1_name, l_nuts_2_name, l_nuts_3_name, l_nuts_4_name, l_nuts_5_name, r_nuts_0_name, r_nuts_1_name, r_nuts_2_name, r_nuts_3_name, r_nuts_4_name, r_nuts_5_name FROM layer_nuts(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./nuts.sql
|
||||
datasources:
|
||||
- type: imposm3
|
||||
mapping_file: ./mapping.yaml
|
||||
26
layers/boundary/nuts.yaml.polygons.backup
Normal file
26
layers/boundary/nuts.yaml.polygons.backup
Normal file
@ -0,0 +1,26 @@
|
||||
layer:
|
||||
id: "nuts"
|
||||
description: |
|
||||
Contains administrative boundaries as polygons (municipalities, counties, provinces, ...)
|
||||
Administrative regions are translated to their equivalent NUTS/LAU classification
|
||||
fields:
|
||||
nuts_level:
|
||||
The NUTS/LAU classification this polygon fall in.
|
||||
NUTS only goes to 3 thus LAU 1 & 2 are mapped as NUTS 4 & 5.
|
||||
NUTS 0 = Countries
|
||||
NUTS 1 = Regions (e.g. Vlaams-brabant)
|
||||
NUTS 2 = Provinces (e.g. Limburg)
|
||||
NUTS 3 = Administrative arrondissements (e.g. Antwerpen, best to ignore these)
|
||||
NUTS 4 = Municipalities (e.g. Lummen)
|
||||
NUTS 5 = Villages/Suburbs (e.g. Linkhout)
|
||||
name: |
|
||||
Name of the region
|
||||
buffer_size: 4
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
query: (SELECT geometry, nuts_level, name FROM osm_boundary_polygon) AS t
|
||||
schema:
|
||||
- ./nuts.sql
|
||||
datasources:
|
||||
- type: imposm3
|
||||
mapping_file: ./mapping.yaml
|
||||
@ -1,287 +1,3 @@
|
||||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "boundary_3",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "boundary",
|
||||
"minzoom": 3,
|
||||
"layout": {
|
||||
"line-join": "round",
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "#845283",
|
||||
"line-width": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
4,
|
||||
0.4
|
||||
],
|
||||
[
|
||||
5,
|
||||
0.7
|
||||
],
|
||||
[
|
||||
12,
|
||||
1.6
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-opacity": {
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
0.5
|
||||
],
|
||||
[
|
||||
10,
|
||||
1
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-dasharray": [
|
||||
5,
|
||||
3
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"admin_level",
|
||||
3,
|
||||
4
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"maritime",
|
||||
0
|
||||
]
|
||||
],
|
||||
"order": 146
|
||||
},
|
||||
{
|
||||
"id": "boundary_2",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "boundary",
|
||||
"minzoom": 0,
|
||||
"layout": {
|
||||
"line-cap": "round",
|
||||
"line-join": "round",
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "#a37da1",
|
||||
"line-width": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
0.5
|
||||
],
|
||||
[
|
||||
5,
|
||||
1.2
|
||||
],
|
||||
[
|
||||
12,
|
||||
3
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-opacity": 1
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"admin_level",
|
||||
2
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"maritime",
|
||||
0
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"disputed",
|
||||
0
|
||||
]
|
||||
],
|
||||
"order": 147
|
||||
},
|
||||
{
|
||||
"id": "boundary_2_disputed",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "boundary",
|
||||
"minzoom": 0,
|
||||
"layout": {
|
||||
"line-cap": "round",
|
||||
"line-join": "round",
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "#a37da1",
|
||||
"line-width": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
0.3
|
||||
],
|
||||
[
|
||||
5,
|
||||
1.2
|
||||
],
|
||||
[
|
||||
12,
|
||||
3
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-opacity": 1,
|
||||
"line-dasharray": [
|
||||
4,
|
||||
3
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"admin_level",
|
||||
2
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"disputed",
|
||||
1
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"maritime",
|
||||
0
|
||||
]
|
||||
],
|
||||
"order": 148
|
||||
},
|
||||
{
|
||||
"id": "boundary_2_disputed_maritime",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "boundary",
|
||||
"minzoom": 0,
|
||||
"layout": {
|
||||
"line-cap": "round",
|
||||
"line-join": "round",
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "rgba(129, 125, 163, 1)",
|
||||
"line-width": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
0.5
|
||||
],
|
||||
[
|
||||
5,
|
||||
1.2
|
||||
],
|
||||
[
|
||||
12,
|
||||
3
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-opacity": 1,
|
||||
"line-dasharray": [
|
||||
4,
|
||||
3
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"admin_level",
|
||||
2
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"disputed",
|
||||
1
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"maritime",
|
||||
1
|
||||
]
|
||||
],
|
||||
"order": 149
|
||||
},
|
||||
{
|
||||
"id": "boundary_2_maritime",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "boundary",
|
||||
"minzoom": 4,
|
||||
"layout": {
|
||||
"line-cap": "round",
|
||||
"line-join": "round",
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "#a37da1",
|
||||
"line-width": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
0.5
|
||||
],
|
||||
[
|
||||
5,
|
||||
1.2
|
||||
],
|
||||
[
|
||||
12,
|
||||
3
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-opacity": 1
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"admin_level",
|
||||
2
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"disputed",
|
||||
0
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"maritime",
|
||||
1
|
||||
]
|
||||
],
|
||||
"order": 150
|
||||
}
|
||||
]
|
||||
"layers": []
|
||||
}
|
||||
@ -29,8 +29,6 @@ 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;
|
||||
DROP TRIGGER IF EXISTS trigger_flag ON osm_boundary_polygon;
|
||||
DROP TRIGGER IF EXISTS trigger_refresh ON boundary_polygon.updates;
|
||||
|
||||
-- etldoc: osm_boundary_polygon -> osm_boundary_polygon
|
||||
-- etldoc: osm_boundary_polygon_gen_z13 -> osm_boundary_polygon_gen_z13
|
||||
@ -100,42 +98,6 @@ CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z7_point_geom_idx ON osm_bou
|
||||
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 SCHEMA IF NOT EXISTS boundary_polygon;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS boundary_polygon.updates
|
||||
(
|
||||
id serial PRIMARY KEY,
|
||||
t text,
|
||||
UNIQUE (t)
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION boundary_polygon.flag() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
INSERT INTO boundary_polygon.updates(t) VALUES ('y') ON CONFLICT(t) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION boundary_polygon.refresh() RETURNS trigger AS
|
||||
$$
|
||||
DECLARE
|
||||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh boundary_polygon';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE osm_boundary_polygon_gen_z5;
|
||||
REFRESH MATERIALIZED VIEW osm_boundary_polygon_gen_z5;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM boundary_polygon.updates;
|
||||
|
||||
RAISE LOG 'Refresh boundary_polygon done in %', age(clock_timestamp(), t);
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_osm_boundary_polygon_row()
|
||||
RETURNS trigger
|
||||
AS
|
||||
@ -206,16 +168,3 @@ CREATE TRIGGER update_row
|
||||
ON osm_boundary_polygon_gen_z5
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_boundary_polygon
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE boundary_polygon.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
AFTER INSERT
|
||||
ON boundary_polygon.updates
|
||||
INITIALLY DEFERRED
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE boundary_polygon.refresh();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"order": 154
|
||||
"order": 149
|
||||
}
|
||||
]
|
||||
}
|
||||
10
layers/landmarks/README.md
Normal file
10
layers/landmarks/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
## Landmarks
|
||||
|
||||
### Docs
|
||||
This is a custom layer including landmarks (named forests) that can not be classified as a POI
|
||||
|
||||
### Mapping Diagram
|
||||
|
||||
|
||||
### ETL diagram
|
||||
|
||||
19
layers/landmarks/class.sql
Normal file
19
layers/landmarks/class.sql
Normal file
@ -0,0 +1,19 @@
|
||||
CREATE OR REPLACE FUNCTION lm_class_rank(class text)
|
||||
RETURNS int AS
|
||||
$$
|
||||
SELECT CASE class
|
||||
WHEN 'forest' THEN 120
|
||||
ELSE 1000
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION lm_class(subclass text, mapping_key text)
|
||||
RETURNS text AS
|
||||
$$
|
||||
SELECT CASE
|
||||
%%FIELD_MAPPING: class %%
|
||||
ELSE subclass
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
BIN
layers/landmarks/etl_diagram.png
Normal file
BIN
layers/landmarks/etl_diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
139
layers/landmarks/landmark.yaml
Normal file
139
layers/landmarks/landmark.yaml
Normal file
@ -0,0 +1,139 @@
|
||||
layer:
|
||||
id: "landmarks"
|
||||
description: |
|
||||
[Points of interests](http://wiki.openstreetmap.org/wiki/Points_of_interest) containing
|
||||
a of a variety of OpenStreetMap tags. Mostly contains amenities, sport, shop and tourist POIs.
|
||||
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`.
|
||||
class:
|
||||
description: |
|
||||
More general classes of landmarks. If there is no more general `class` for the `subclass`
|
||||
this field will contain the same value as `subclass`.
|
||||
values:
|
||||
shop:
|
||||
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist',
|
||||
'coffee', 'computer', 'convenience', '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', 'lamps', 'mall', 'massage', 'motorcycle', 'mobile_phone', 'newsagent',
|
||||
'optician', 'outdoor', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand', 'shoes', 'sports',
|
||||
'stationery', 'tailor', 'tattoo', 'ticket', 'tobacco', 'toys', 'travel_agency', 'watches',
|
||||
'weapons', 'wholesale']
|
||||
town_hall:
|
||||
subclass: ['townhall', 'public_building', 'courthouse', 'community_centre']
|
||||
golf:
|
||||
subclass: ['golf', 'golf_course', 'miniature_golf']
|
||||
fast_food:
|
||||
subclass: ['fast_food', 'food_court']
|
||||
park:
|
||||
subclass: ['park', 'bbq']
|
||||
bus:
|
||||
subclass: ['bus_stop', 'bus_station']
|
||||
railway:
|
||||
- __AND__:
|
||||
subclass: 'station'
|
||||
mapping_key: 'railway'
|
||||
- subclass: ['halt', 'tram_stop', 'subway']
|
||||
aerialway:
|
||||
__AND__:
|
||||
subclass: 'station'
|
||||
mapping_key: 'aerialway'
|
||||
entrance:
|
||||
subclass: ['subway_entrance', 'train_station_entrance']
|
||||
campsite:
|
||||
subclass: ['camp_site', 'caravan_site']
|
||||
laundry:
|
||||
subclass: ['laundry', 'dry_cleaning']
|
||||
grocery:
|
||||
subclass: ['supermarket', 'deli', 'delicatessen', 'department_store', 'greengrocer', 'marketplace']
|
||||
library:
|
||||
subclass: ['books', 'library']
|
||||
college:
|
||||
subclass: ['university', 'college']
|
||||
lodging:
|
||||
subclass: ['hotel', 'motel', 'bed_and_breakfast', 'guest_house', 'hostel', 'chalet', 'alpine_hut', 'dormitory']
|
||||
ice_cream:
|
||||
subclass: ['chocolate', 'confectionery']
|
||||
post:
|
||||
subclass: ['post_box', 'post_office']
|
||||
cafe:
|
||||
subclass: ['cafe']
|
||||
school:
|
||||
subclass: ['school', 'kindergarten']
|
||||
alcohol_shop:
|
||||
subclass: ['alcohol', 'beverages', 'wine']
|
||||
bar:
|
||||
subclass: ['bar', 'nightclub']
|
||||
harbor:
|
||||
subclass: ['marina', 'dock']
|
||||
car:
|
||||
subclass: ['car', 'car_repair', 'car_parts', 'taxi']
|
||||
hospital:
|
||||
subclass: ['hospital', 'nursing_home', 'clinic']
|
||||
cemetery:
|
||||
subclass: ['grave_yard', 'cemetery']
|
||||
attraction:
|
||||
subclass: ['attraction', 'viewpoint']
|
||||
beer:
|
||||
subclass: ['biergarten', 'pub']
|
||||
music:
|
||||
subclass: ['music', 'musical_instrument']
|
||||
stadium:
|
||||
subclass: ['american_football', 'stadium', 'soccer']
|
||||
art_gallery:
|
||||
subclass: ['art', 'artwork', 'gallery', 'arts_centre']
|
||||
clothing_store:
|
||||
subclass: ['bag', 'clothes']
|
||||
swimming:
|
||||
subclass: ['swimming_area', 'swimming']
|
||||
castle:
|
||||
subclass: ['castle', 'ruins']
|
||||
subclass:
|
||||
description: |
|
||||
Original value of either the
|
||||
[`amenity`](http://wiki.openstreetmap.org/wiki/Key:amenity),
|
||||
[`barrier`](http://wiki.openstreetmap.org/wiki/Key:barrier),
|
||||
[`historic`](http://wiki.openstreetmap.org/wiki/Key:historic),
|
||||
[`information`](http://wiki.openstreetmap.org/wiki/Key:information),
|
||||
[`landuse`](http://wiki.openstreetmap.org/wiki/Key:landuse),
|
||||
[`leisure`](http://wiki.openstreetmap.org/wiki/Key:leisure),
|
||||
[`railway`](http://wiki.openstreetmap.org/wiki/Key:railway),
|
||||
[`shop`](http://wiki.openstreetmap.org/wiki/Key:shop),
|
||||
[`sport`](http://wiki.openstreetmap.org/wiki/Key:sport),
|
||||
[`station`](http://wiki.openstreetmap.org/wiki/Key:station),
|
||||
[`religion`](http://wiki.openstreetmap.org/wiki/Key:religion),
|
||||
[`tourism`](http://wiki.openstreetmap.org/wiki/Key:tourism),
|
||||
[`aerialway`](http://wiki.openstreetmap.org/wiki/Key:aerialway),
|
||||
[`building`](http://wiki.openstreetmap.org/wiki/Key:building),
|
||||
[`highway`](http://wiki.openstreetmap.org/wiki/Key:highway)
|
||||
or [`waterway`](http://wiki.openstreetmap.org/wiki/Key:waterway)
|
||||
tag. Use this to do more precise styling.
|
||||
rank: |
|
||||
The POIs are ranked ascending according to their importance within a grid. The `rank` value shows the
|
||||
local relative importance of a POI within it's cell in the grid. This can be used to reduce label density at *z14*.
|
||||
Since all POIs already need to be contained at *z14* you can use `less than rank=10` epxression to limit
|
||||
LMs. At some point like *z17* you can show all LMs.
|
||||
level:
|
||||
description: |
|
||||
Original value of [`level`](http://wiki.openstreetmap.org/wiki/Key:level) tag.
|
||||
layer:
|
||||
description: |
|
||||
Original value of [`layer`](http://wiki.openstreetmap.org/wiki/Key:layer) tag.
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
key_field: osm_id
|
||||
key_field_as_attribute: no
|
||||
srid: 900913
|
||||
query: (SELECT osm_id, geometry, name, name_en, name_de, {name_languages}, class, subclass, layer, level, rank FROM layer_lm(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
|
||||
schema:
|
||||
- ./class.sql
|
||||
- ./update_lm_polygon.sql
|
||||
- ./update_lm_point.sql
|
||||
- ./layer.sql
|
||||
datasources:
|
||||
- type: imposm3
|
||||
mapping_file: ./mapping.yaml
|
||||
85
layers/landmarks/layer.sql
Normal file
85
layers/landmarks/layer.sql
Normal file
@ -0,0 +1,85 @@
|
||||
-- etldoc: layer_lm[shape=record fillcolor=lightpink, style="rounded,filled",
|
||||
-- etldoc: label="layer_lm | <z12> z12 | <z13> z13 | <z14_> z14+" ] ;
|
||||
|
||||
CREATE OR REPLACE FUNCTION layer_lm(bbox geometry, zoom_level integer, pixel_width numeric)
|
||||
RETURNS TABLE
|
||||
(
|
||||
osm_id bigint,
|
||||
geometry geometry,
|
||||
name text,
|
||||
name_en text,
|
||||
name_de text,
|
||||
tags hstore,
|
||||
class text,
|
||||
subclass text,
|
||||
layer integer,
|
||||
level integer,
|
||||
"rank" int
|
||||
)
|
||||
AS
|
||||
$$
|
||||
SELECT osm_id_hash AS osm_id,
|
||||
geometry,
|
||||
NULLIF(name, '') AS name,
|
||||
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
||||
tags,
|
||||
lm_class(subclass, mapping_key) AS class,
|
||||
subclass AS subclass,
|
||||
NULLIF(layer, 0) AS layer,
|
||||
"level",
|
||||
row_number() OVER (
|
||||
PARTITION BY LabelGrid(geometry, 100 * pixel_width)
|
||||
ORDER BY CASE WHEN name = '' THEN 2000 ELSE lm_class_rank(lm_class(subclass, mapping_key)) END ASC
|
||||
)::int AS "rank"
|
||||
FROM (
|
||||
-- etldoc: osm_lm_point -> layer_lm:z12
|
||||
-- etldoc: osm_lm_point -> layer_lm:z13
|
||||
SELECT *,
|
||||
osm_id * 10 AS osm_id_hash
|
||||
FROM osm_lm_point
|
||||
WHERE geometry && bbox
|
||||
AND zoom_level BETWEEN 12 AND 13
|
||||
AND ((subclass = 'station' AND mapping_key = 'railway')
|
||||
OR subclass IN ('halt', 'ferry_terminal'))
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_lm_point -> layer_lm:z14_
|
||||
SELECT *,
|
||||
osm_id * 10 AS osm_id_hash
|
||||
FROM osm_lm_point
|
||||
WHERE geometry && bbox
|
||||
AND zoom_level >= 14
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_lm_polygon -> layer_lm:z12
|
||||
-- etldoc: osm_lm_polygon -> layer_lm:z13
|
||||
SELECT *,
|
||||
CASE
|
||||
WHEN osm_id < 0 THEN -osm_id * 10 + 4
|
||||
ELSE osm_id * 10 + 1
|
||||
END AS osm_id_hash
|
||||
FROM osm_lm_polygon
|
||||
WHERE geometry && bbox
|
||||
AND zoom_level BETWEEN 12 AND 13
|
||||
AND ((subclass = 'station' AND mapping_key = 'railway')
|
||||
OR subclass IN ('halt', 'ferry_terminal'))
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_lm_polygon -> layer_lm:z14_
|
||||
SELECT *,
|
||||
CASE
|
||||
WHEN osm_id < 0 THEN -osm_id * 10 + 4
|
||||
ELSE osm_id * 10 + 1
|
||||
END AS osm_id_hash
|
||||
FROM osm_lm_polygon
|
||||
WHERE geometry && bbox
|
||||
AND zoom_level >= 14
|
||||
) AS lm_union
|
||||
ORDER BY "rank"
|
||||
$$ LANGUAGE SQL STABLE
|
||||
PARALLEL SAFE;
|
||||
-- TODO: Check if the above can be made STRICT -- i.e. if pixel_width could be NULL
|
||||
74
layers/landmarks/mapping.yaml
Normal file
74
layers/landmarks/mapping.yaml
Normal file
@ -0,0 +1,74 @@
|
||||
|
||||
# imposm3 mapping file for https://github.com/osm2vectortiles/imposm3
|
||||
# Warning: this is not the official imposm3
|
||||
|
||||
# landuse values , see http://taginfo.openstreetmap.org/keys/landuse#values
|
||||
def_lm_mapping_landuse: &lm_mapping_landuse
|
||||
- forest
|
||||
|
||||
def_poi_fields: &lm_fields
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
type: geometry
|
||||
- name: name
|
||||
key: name
|
||||
type: string
|
||||
- name: name_en
|
||||
key: name:en
|
||||
type: string
|
||||
- name: name_de
|
||||
key: name:de
|
||||
type: string
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- name: subclass
|
||||
type: mapping_value
|
||||
- name: mapping_key
|
||||
type: mapping_key
|
||||
- name: station
|
||||
key: station
|
||||
type: string
|
||||
- name: funicular
|
||||
key: funicular
|
||||
type: string
|
||||
- name: information
|
||||
key: information
|
||||
type: string
|
||||
- name: uic_ref
|
||||
key: uic_ref
|
||||
type: string
|
||||
- name: religion
|
||||
key: religion
|
||||
type: string
|
||||
- name: level
|
||||
key: level
|
||||
type: integer
|
||||
- name: layer
|
||||
key: layer
|
||||
type: integer
|
||||
- name: sport
|
||||
key: sport
|
||||
type: string
|
||||
|
||||
def_lm_mapping: &lm_mapping
|
||||
landuse: *lm_mapping_landuse
|
||||
|
||||
tables:
|
||||
# etldoc: imposm3 -> osm_lm_point
|
||||
lm_point:
|
||||
type: point
|
||||
columns: *lm_fields
|
||||
filters:
|
||||
require:
|
||||
name: ["__any__"]
|
||||
mapping: *lm_mapping
|
||||
|
||||
# etldoc: imposm3 -> osm_lm_polygon
|
||||
lm_polygon:
|
||||
type: polygon
|
||||
columns: *lm_fields
|
||||
filters:
|
||||
require:
|
||||
name: ["__any__"]
|
||||
mapping: *lm_mapping
|
||||
BIN
layers/landmarks/mapping_diagram.png
Normal file
BIN
layers/landmarks/mapping_diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
3
layers/landmarks/style.json
Normal file
3
layers/landmarks/style.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"layers": []
|
||||
}
|
||||
69
layers/landmarks/update_lm_point.sql
Normal file
69
layers/landmarks/update_lm_point.sql
Normal file
@ -0,0 +1,69 @@
|
||||
DROP TRIGGER IF EXISTS trigger_flag ON osm_lm_point;
|
||||
DROP TRIGGER IF EXISTS trigger_refresh ON lm_point.updates;
|
||||
|
||||
-- etldoc: osm_lm_point -> osm_lm_point
|
||||
CREATE OR REPLACE FUNCTION update_osm_lm_point() RETURNS void AS
|
||||
$$
|
||||
BEGIN
|
||||
UPDATE osm_lm_point
|
||||
SET subclass = 'subway'
|
||||
WHERE station = 'subway'
|
||||
AND subclass = 'station';
|
||||
|
||||
UPDATE osm_lm_point
|
||||
SET subclass = 'halt'
|
||||
WHERE funicular = 'yes'
|
||||
AND subclass = 'station';
|
||||
|
||||
UPDATE osm_lm_point
|
||||
SET tags = update_tags(tags, geometry)
|
||||
WHERE COALESCE(tags->'name:latin', tags->'name:nonlatin', tags->'name_int') IS NULL;
|
||||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
SELECT update_osm_lm_point();
|
||||
|
||||
-- Handle updates
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS lm_point;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS lm_point.updates
|
||||
(
|
||||
id serial PRIMARY KEY,
|
||||
t text,
|
||||
UNIQUE (t)
|
||||
);
|
||||
CREATE OR REPLACE FUNCTION lm_point.flag() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
INSERT INTO lm_point.updates(t) VALUES ('y') ON CONFLICT(t) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION lm_point.refresh() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh lm_point';
|
||||
PERFORM update_osm_lm_point();
|
||||
REFRESH MATERIALIZED VIEW osm_lm_stop_centroid;
|
||||
REFRESH MATERIALIZED VIEW osm_lm_stop_rank;
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM lm_point.updates;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_lm_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE lm_point.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
AFTER INSERT
|
||||
ON lm_point.updates
|
||||
INITIALLY DEFERRED
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE lm_point.refresh();
|
||||
78
layers/landmarks/update_lm_polygon.sql
Normal file
78
layers/landmarks/update_lm_polygon.sql
Normal file
@ -0,0 +1,78 @@
|
||||
DROP TRIGGER IF EXISTS trigger_flag ON osm_lm_polygon;
|
||||
DROP TRIGGER IF EXISTS trigger_refresh ON lm_polygon.updates;
|
||||
|
||||
-- etldoc: osm_lm_polygon -> osm_lm_polygon
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_lm_polygon() RETURNS void AS
|
||||
$$
|
||||
BEGIN
|
||||
UPDATE osm_lm_polygon
|
||||
SET geometry =
|
||||
CASE
|
||||
WHEN ST_NPoints(ST_ConvexHull(geometry)) = ST_NPoints(geometry)
|
||||
THEN ST_Centroid(geometry)
|
||||
ELSE ST_PointOnSurface(geometry)
|
||||
END
|
||||
WHERE ST_GeometryType(geometry) <> 'ST_Point';
|
||||
|
||||
UPDATE osm_lm_polygon
|
||||
SET subclass = 'subway'
|
||||
WHERE station = 'subway'
|
||||
AND subclass = 'station';
|
||||
|
||||
UPDATE osm_lm_polygon
|
||||
SET subclass = 'halt'
|
||||
WHERE funicular = 'yes'
|
||||
AND subclass = 'station';
|
||||
|
||||
UPDATE osm_lm_polygon
|
||||
SET tags = update_tags(tags, geometry)
|
||||
WHERE COALESCE(tags->'name:latin', tags->'name:nonlatin', tags->'name_int') IS NULL;
|
||||
|
||||
ANALYZE osm_lm_polygon;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
SELECT update_lm_polygon();
|
||||
|
||||
-- Handle updates
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS lm_polygon;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS lm_polygon.updates
|
||||
(
|
||||
id serial PRIMARY KEY,
|
||||
t text,
|
||||
UNIQUE (t)
|
||||
);
|
||||
CREATE OR REPLACE FUNCTION lm_polygon.flag() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
INSERT INTO lm_polygon.updates(t) VALUES ('y') ON CONFLICT(t) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION lm_polygon.refresh() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh lm_polygon';
|
||||
PERFORM update_lm_polygon();
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM lm_polygon.updates;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_lm_polygon
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE lm_polygon.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
AFTER INSERT
|
||||
ON lm_polygon.updates
|
||||
INITIALLY DEFERRED
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE lm_polygon.refresh();
|
||||
@ -12,6 +12,7 @@ SELECT
|
||||
NULL::text AS tourism,
|
||||
NULL::text AS place,
|
||||
NULL::text AS waterway,
|
||||
NULL::text AS man_made,
|
||||
scalerank
|
||||
FROM ne_50m_urban_areas
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
@ -29,7 +30,8 @@ SELECT
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM ne_50m_urban_areas_gen_z5
|
||||
WHERE scalerank <= 2
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
@ -46,7 +48,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z6_union AS
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z6
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
@ -57,7 +60,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z6_union AS
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
'' AS waterway,
|
||||
'' AS man_made
|
||||
FROM osm_residential_gen_z6
|
||||
);
|
||||
|
||||
@ -72,7 +76,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z7_union AS
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z7
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
@ -83,7 +88,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z7_union AS
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
'' AS waterway,
|
||||
'' AS man_made
|
||||
FROM osm_residential_gen_z7
|
||||
);
|
||||
|
||||
@ -98,7 +104,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z8_union AS
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z8
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
@ -109,7 +116,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z8_union AS
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
'' AS waterway,
|
||||
'' AS man_made
|
||||
FROM osm_residential_gen_z8
|
||||
);
|
||||
|
||||
@ -124,7 +132,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z9_union AS
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z9
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
@ -135,7 +144,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z9_union AS
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
'' AS waterway,
|
||||
'' AS man_made
|
||||
FROM osm_residential_gen_z9
|
||||
);
|
||||
|
||||
@ -150,7 +160,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z10_union AS
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z10
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
@ -161,7 +172,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z10_union AS
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
'' AS waterway,
|
||||
'' AS man_made
|
||||
FROM osm_residential_gen_z10
|
||||
);
|
||||
|
||||
@ -176,7 +188,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z11_union AS
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z11
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
@ -187,7 +200,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z11_union AS
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
'' AS waterway,
|
||||
'' AS man_made
|
||||
FROM osm_residential_gen_z11
|
||||
);
|
||||
|
||||
@ -202,7 +216,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z12_union AS
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z12
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
@ -213,7 +228,8 @@ CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z12_union AS
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
'' AS waterway,
|
||||
'' AS man_made
|
||||
FROM osm_residential_gen_z12
|
||||
);
|
||||
|
||||
@ -238,7 +254,8 @@ SELECT osm_id,
|
||||
NULLIF(leisure, ''),
|
||||
NULLIF(tourism, ''),
|
||||
NULLIF(place, ''),
|
||||
NULLIF(waterway, '')
|
||||
NULLIF(waterway, ''),
|
||||
NULLIF(man_made, '')
|
||||
)) AS class
|
||||
FROM (
|
||||
-- etldoc: ne_50m_urban_areas_gen_z4 -> layer_landuse:z4
|
||||
@ -249,7 +266,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM ne_50m_urban_areas_gen_z4
|
||||
WHERE zoom_level = 4
|
||||
UNION ALL
|
||||
@ -261,7 +279,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM ne_50m_urban_areas_gen_z5
|
||||
WHERE zoom_level = 5
|
||||
UNION ALL
|
||||
@ -273,7 +292,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z6_union
|
||||
WHERE zoom_level = 6
|
||||
UNION ALL
|
||||
@ -285,7 +305,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z7_union
|
||||
WHERE zoom_level = 7
|
||||
UNION ALL
|
||||
@ -297,7 +318,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z8_union
|
||||
WHERE zoom_level = 8
|
||||
UNION ALL
|
||||
@ -309,7 +331,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z9_union
|
||||
WHERE zoom_level = 9
|
||||
UNION ALL
|
||||
@ -321,7 +344,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z10_union
|
||||
WHERE zoom_level = 10
|
||||
UNION ALL
|
||||
@ -333,7 +357,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z11_union
|
||||
WHERE zoom_level = 11
|
||||
UNION ALL
|
||||
@ -345,7 +370,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z12_union
|
||||
WHERE zoom_level = 12
|
||||
UNION ALL
|
||||
@ -357,7 +383,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon_gen_z13
|
||||
WHERE zoom_level = 13
|
||||
UNION ALL
|
||||
@ -369,7 +396,8 @@ FROM (
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
waterway,
|
||||
man_made
|
||||
FROM osm_landuse_polygon
|
||||
WHERE zoom_level >= 14
|
||||
) AS zoom_levels
|
||||
|
||||
@ -44,6 +44,14 @@ layer:
|
||||
- quarter
|
||||
- neighbourhood
|
||||
- dam
|
||||
- sports_centre
|
||||
- parking
|
||||
- motorcycle_parking
|
||||
- bicycle_parking
|
||||
- religious
|
||||
- prison
|
||||
- wastewater_plant
|
||||
- water_works
|
||||
- quarry
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
|
||||
@ -69,6 +69,9 @@ tables:
|
||||
type: string
|
||||
- name: area
|
||||
type: area
|
||||
- name: man_made
|
||||
key: man_made
|
||||
type: string
|
||||
mapping:
|
||||
landuse:
|
||||
- railway
|
||||
@ -81,6 +84,8 @@ tables:
|
||||
- industrial
|
||||
- garages
|
||||
- retail
|
||||
- religious
|
||||
- construction
|
||||
amenity:
|
||||
- bus_station
|
||||
- school
|
||||
@ -89,18 +94,28 @@ tables:
|
||||
- college
|
||||
- library
|
||||
- hospital
|
||||
- parking
|
||||
- prison
|
||||
- motorcycle_parking
|
||||
- bicycle_parking
|
||||
- animal_training
|
||||
- grave_yard
|
||||
leisure:
|
||||
- stadium
|
||||
- pitch
|
||||
- playground
|
||||
- track
|
||||
- sports_centre
|
||||
tourism:
|
||||
- theme_park
|
||||
- zoo
|
||||
- picnic_site
|
||||
place:
|
||||
- suburb
|
||||
- quarter
|
||||
- neighbourhood
|
||||
waterway:
|
||||
- dam
|
||||
man_made:
|
||||
- wastewater_plant
|
||||
- water_works
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
"text-halo-color": "rgba(255, 255, 255, .8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"order": 197
|
||||
"order": 192
|
||||
},
|
||||
{
|
||||
"id": "mountain_peak_volcano",
|
||||
@ -95,7 +95,7 @@
|
||||
"text-halo-color": "rgba(255, 255, 255, .8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"order": 198
|
||||
"order": 193
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -105,7 +105,7 @@
|
||||
2
|
||||
]
|
||||
],
|
||||
"order": 195
|
||||
"order": 190
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -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;
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
"borough"
|
||||
]
|
||||
],
|
||||
"order": 193
|
||||
"order": 188
|
||||
},
|
||||
{
|
||||
"id": "place_village",
|
||||
@ -129,7 +129,7 @@
|
||||
"village"
|
||||
]
|
||||
],
|
||||
"order": 199
|
||||
"order": 194
|
||||
},
|
||||
{
|
||||
"id": "place_town",
|
||||
@ -177,7 +177,7 @@
|
||||
"town"
|
||||
]
|
||||
],
|
||||
"order": 200
|
||||
"order": 195
|
||||
},
|
||||
{
|
||||
"id": "place_state",
|
||||
@ -228,7 +228,7 @@
|
||||
3
|
||||
]
|
||||
],
|
||||
"order": 201
|
||||
"order": 196
|
||||
},
|
||||
{
|
||||
"id": "place_city",
|
||||
@ -311,7 +311,7 @@
|
||||
1
|
||||
]
|
||||
],
|
||||
"order": 202
|
||||
"order": 197
|
||||
},
|
||||
{
|
||||
"id": "place_capital",
|
||||
@ -396,7 +396,7 @@
|
||||
2
|
||||
]
|
||||
],
|
||||
"order": 203
|
||||
"order": 198
|
||||
},
|
||||
{
|
||||
"id": "country_other",
|
||||
@ -449,7 +449,7 @@
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 204
|
||||
"order": 199
|
||||
},
|
||||
{
|
||||
"id": "country_3",
|
||||
@ -518,7 +518,7 @@
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 205
|
||||
"order": 200
|
||||
},
|
||||
{
|
||||
"id": "country_2",
|
||||
@ -587,7 +587,7 @@
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 206
|
||||
"order": 201
|
||||
},
|
||||
{
|
||||
"id": "country_1",
|
||||
@ -656,7 +656,7 @@
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 207
|
||||
"order": 202
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -99,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
|
||||
|
||||
@ -148,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
|
||||
|
||||
@ -110,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
|
||||
|
||||
@ -1,12 +1,21 @@
|
||||
CREATE OR REPLACE FUNCTION poi_class_rank(class text)
|
||||
CREATE OR REPLACE FUNCTION poi_class_rank(class text, subclass text)
|
||||
RETURNS int AS
|
||||
$$
|
||||
SELECT CASE class
|
||||
WHEN 'hospital' THEN 20
|
||||
WHEN 'airport' THEN 30
|
||||
WHEN 'railway' THEN 40
|
||||
WHEN 'bus' THEN 50
|
||||
WHEN 'attraction' THEN 70
|
||||
WHEN 'harbor' THEN 75
|
||||
WHEN 'aerialway' THEN 40
|
||||
WHEN 'heliport' THEN 45
|
||||
WHEN 'taxi' THEN 50
|
||||
WHEN 'harbor' THEN 55
|
||||
WHEN 'library' THEN 60
|
||||
WHEN 'bus' THEN
|
||||
CASE subclass
|
||||
WHEN 'bus_station' THEN 70
|
||||
ELSE 72
|
||||
END
|
||||
WHEN 'attraction' THEN 75
|
||||
WHEN 'college' THEN 80
|
||||
WHEN 'school' THEN 85
|
||||
WHEN 'stadium' THEN 90
|
||||
@ -19,17 +28,51 @@ SELECT CASE class
|
||||
WHEN 'police' THEN 135
|
||||
WHEN 'post' THEN 140
|
||||
WHEN 'golf' THEN 150
|
||||
WHEN 'shop' THEN 400
|
||||
WHEN 'grocery' THEN 500
|
||||
WHEN 'fast_food' THEN 600
|
||||
WHEN 'clothing_store' THEN 700
|
||||
WHEN 'bar' THEN 800
|
||||
WHEN 'entrance' THEN 250
|
||||
WHEN 'parking' THEN 300
|
||||
WHEN 'car_parking' THEN 300
|
||||
WHEN 'fuel' THEN 350
|
||||
WHEN 'charging_station' THEN 355
|
||||
WHEN 'bicycle_parking' THEN 360
|
||||
WHEN 'motorcycle_parking' THEN 360
|
||||
WHEN 'bank' THEN 380
|
||||
WHEN 'art_gallery' THEN 400
|
||||
WHEN 'information' THEN 420
|
||||
WHEN 'fast_food' THEN 430
|
||||
WHEN 'ice_cream' THEN 430
|
||||
WHEN 'bar' THEN 450
|
||||
WHEN 'cafe' THEN 450
|
||||
WHEN 'grocery' THEN 450
|
||||
WHEN 'bakery' THEN 475
|
||||
WHEN 'community_centre' THEN 500
|
||||
WHEN 'shop' THEN 600
|
||||
WHEN 'optician' THEN 600
|
||||
WHEN 'furniture' THEN 600
|
||||
WHEN 'jewelry' THEN 600
|
||||
WHEN 'toys' THEN 600
|
||||
WHEN 'newsagent' THEN 600
|
||||
WHEN 'paint' THEN 600
|
||||
WHEN 'electronics' THEN 600
|
||||
WHEN 'garden_centre' THEN 600
|
||||
WHEN 'mobile_phone' THEN 600
|
||||
WHEN 'shoes' THEN 600
|
||||
WHEN 'clothing_store' THEN 600
|
||||
WHEN 'florist' THEN 600
|
||||
WHEN 'laundry' THEN 700
|
||||
WHEN 'dog_park' THEN 800
|
||||
WHEN 'pitch' THEN 800
|
||||
WHEN 'power_tower' then 900
|
||||
WHEN 'wind_mill' then 900
|
||||
WHEN 'water_tower' then 900
|
||||
WHEN 'communications_tower' then 900
|
||||
WHEN 'wind_turbine' then 900
|
||||
WHEN 'shelter' then 3000
|
||||
ELSE 1000
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION poi_class(subclass text, mapping_key text)
|
||||
CREATE OR REPLACE FUNCTION poi_class(subclass text, mapping_key text, subtype text)
|
||||
RETURNS text AS
|
||||
$$
|
||||
SELECT CASE
|
||||
|
||||
@ -23,6 +23,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity
|
||||
- clinic
|
||||
- college
|
||||
- community_centre
|
||||
- social_facility
|
||||
- courthouse
|
||||
- dentist
|
||||
- doctors
|
||||
@ -64,6 +65,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity
|
||||
- university
|
||||
- veterinary
|
||||
- waste_basket
|
||||
- charging_station
|
||||
|
||||
# barrier values , see http://taginfo.openstreetmap.org/keys/barrier#values
|
||||
def_poi_mapping_barrier: &poi_mapping_barrier
|
||||
@ -79,10 +81,13 @@ def_poi_mapping_barrier: &poi_mapping_barrier
|
||||
# building values , see http://taginfo.openstreetmap.org/keys/building#values
|
||||
def_poi_mapping_building: &poi_mapping_building
|
||||
- dormitory
|
||||
- office
|
||||
- industrial
|
||||
|
||||
# highway values , see http://taginfo.openstreetmap.org/keys/highway#values
|
||||
def_poi_mapping_highway: &poi_mapping_highway
|
||||
- bus_stop
|
||||
- speed_camera
|
||||
|
||||
# historic values , see http://taginfo.openstreetmap.org/keys/historic#values
|
||||
def_poi_mapping_historic: &poi_mapping_historic
|
||||
@ -102,7 +107,6 @@ def_poi_mapping_landuse: &poi_mapping_landuse
|
||||
def_poi_mapping_leisure: &poi_mapping_leisure
|
||||
- dog_park
|
||||
- escape_game
|
||||
- garden
|
||||
- golf_course
|
||||
- ice_rink
|
||||
- hackerspace
|
||||
@ -116,6 +120,15 @@ def_poi_mapping_leisure: &poi_mapping_leisure
|
||||
- swimming_area
|
||||
- swimming_pool
|
||||
- water_park
|
||||
- nature_reserve
|
||||
- dance
|
||||
- picnic_table
|
||||
- outdoor_seating
|
||||
- slipway
|
||||
- resort
|
||||
- marina
|
||||
- fitness_centre
|
||||
- fitness_station
|
||||
|
||||
# office values , see http://taginfo.openstreetmap.org/keys/office#values
|
||||
def_poi_mapping_office: &poi_mapping_office
|
||||
@ -383,6 +396,24 @@ def_poi_mapping_tourism: &poi_mapping_tourism
|
||||
def_poi_mapping_waterway: &poi_mapping_waterway
|
||||
- dock
|
||||
|
||||
# aeroway values , see http://taginfo.openstreetmap.org/keys/aeroway#values
|
||||
def_poi_mapping_aeroway: &poi_mapping_aeroway
|
||||
- helipad
|
||||
- aerodrome
|
||||
|
||||
# aeroway values , see http://taginfo.openstreetmap.org/keys/aeroway#values
|
||||
def_poi_mapping_power: &poi_mapping_power
|
||||
- generator
|
||||
- tower
|
||||
|
||||
def_poi_mapping_man_made: &poi_mapping_man_made
|
||||
- communications_tower
|
||||
- water_tower
|
||||
- wind_mill
|
||||
|
||||
def_poi_mapping_emergency: &poi_mapping_emergency
|
||||
- defibrillator
|
||||
|
||||
def_poi_fields: &poi_fields
|
||||
- name: osm_id
|
||||
type: id
|
||||
@ -435,6 +466,12 @@ def_poi_fields: &poi_fields
|
||||
- name: sport
|
||||
key: sport
|
||||
type: string
|
||||
- name: power
|
||||
key: power
|
||||
type: string
|
||||
- name: source
|
||||
key: "generator:source"
|
||||
type: string
|
||||
- name: operator
|
||||
key: operator
|
||||
type: string
|
||||
@ -460,6 +497,10 @@ def_poi_mapping: &poi_mapping
|
||||
sport: *poi_mapping_sport
|
||||
tourism: *poi_mapping_tourism
|
||||
waterway: *poi_mapping_waterway
|
||||
aeroway: *poi_mapping_aeroway
|
||||
power: *poi_mapping_power
|
||||
man_made: *poi_mapping_man_made
|
||||
emergency: *poi_mapping_emergency
|
||||
|
||||
tables:
|
||||
# etldoc: imposm3 -> osm_poi_point
|
||||
|
||||
@ -26,7 +26,7 @@ SELECT osm_id_hash AS osm_id,
|
||||
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
||||
tags,
|
||||
poi_class(subclass, mapping_key) AS class,
|
||||
poi_class(subclass, mapping_key, subtype) AS class,
|
||||
CASE
|
||||
WHEN subclass = 'information'
|
||||
THEN NULLIF(information, '')
|
||||
@ -34,6 +34,8 @@ SELECT osm_id_hash AS osm_id,
|
||||
THEN NULLIF(religion, '')
|
||||
WHEN subclass = 'pitch'
|
||||
THEN NULLIF(sport, '')
|
||||
WHEN subclass = 'sports_centre'
|
||||
THEN NULLIF(sport, subclass)
|
||||
ELSE subclass
|
||||
END AS subclass,
|
||||
agg_stop,
|
||||
@ -42,9 +44,33 @@ SELECT osm_id_hash AS osm_id,
|
||||
CASE WHEN indoor = TRUE THEN 1 END AS indoor,
|
||||
row_number() OVER (
|
||||
PARTITION BY LabelGrid(geometry, 100 * pixel_width)
|
||||
ORDER BY CASE WHEN name = '' THEN 2000 ELSE poi_class_rank(poi_class(subclass, mapping_key)) END ASC
|
||||
)::int AS "rank"
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN name = ''
|
||||
THEN 2000
|
||||
ELSE poi_class_rank(poi_class(
|
||||
subclass,
|
||||
mapping_key,
|
||||
subtype
|
||||
), subclass) END ASC
|
||||
)::int AS "rank"
|
||||
FROM (
|
||||
-- Intermediate mapping for subtype and filtering out nameless industrial/office buildings
|
||||
SELECT *,
|
||||
CASE
|
||||
WHEN subclass = 'information'
|
||||
THEN NULLIF(information, '')
|
||||
WHEN subclass = 'place_of_worship'
|
||||
THEN NULLIF(religion, '')
|
||||
WHEN subclass = 'pitch'
|
||||
THEN NULLIF(sport, '')
|
||||
WHEN subclass = 'sports_centre'
|
||||
THEN NULLIF(sport, '')
|
||||
WHEN subclass = 'generator' AND mapping_key = 'power'
|
||||
THEN NULLIF(source, '')
|
||||
ELSE subclass
|
||||
END as subtype
|
||||
FROM (
|
||||
-- etldoc: osm_poi_point -> layer_poi:z12
|
||||
-- etldoc: osm_poi_point -> layer_poi:z13
|
||||
SELECT *,
|
||||
@ -68,6 +94,20 @@ FROM (
|
||||
|
||||
-- etldoc: osm_poi_polygon -> layer_poi:z12
|
||||
-- etldoc: osm_poi_polygon -> layer_poi:z13
|
||||
-- OLD
|
||||
-- SELECT *,
|
||||
-- NULL::integer AS agg_stop,
|
||||
-- CASE
|
||||
-- WHEN osm_id < 0 THEN -osm_id * 10 + 4
|
||||
-- ELSE osm_id * 10 + 1
|
||||
-- END AS osm_id_hash
|
||||
-- FROM osm_poi_polygon
|
||||
-- WHERE geometry && bbox
|
||||
-- AND zoom_level BETWEEN 12 AND 13
|
||||
-- AND ((subclass = 'station' AND mapping_key = 'railway')
|
||||
-- OR subclass IN ('halt', 'ferry_terminal'))
|
||||
--
|
||||
-- UNION ALL
|
||||
-- etldoc: osm_poi_polygon -> layer_poi:z14_
|
||||
SELECT *,
|
||||
NULL::integer AS agg_stop,
|
||||
@ -76,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
|
||||
@ -91,7 +131,9 @@ FROM (
|
||||
-- Match features that are at least 10% of a tile at this zoom
|
||||
> 0.10
|
||||
ELSE FALSE END
|
||||
) AS poi_union
|
||||
) AS poi_union_raw
|
||||
WHERE NOT (mapping_key = 'building' AND (subclass = 'office' OR subclass = 'industrial') AND coalesce(name, name_en, '') = '')
|
||||
) AS poi_union
|
||||
ORDER BY "rank"
|
||||
$$ LANGUAGE SQL STABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
@ -20,23 +20,51 @@ layer:
|
||||
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', 'interior_decoration',
|
||||
'general', 'gift', 'hardware', 'hearing_aids', 'hifi', 'ice_cream', 'interior_decoration',
|
||||
'jewelry', 'kiosk', 'locksmith', 'lamps', 'mall', 'massage', 'motorcycle', 'mobile_phone',
|
||||
'newsagent', 'optician', 'outdoor', 'paint', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand',
|
||||
'shoes', 'sports', 'stationery', 'tailor', 'tattoo', 'ticket', 'tobacco', 'toys', 'travel_agency',
|
||||
'watches', 'weapons', 'wholesale']
|
||||
'newsagent', 'optician', 'outdoor', 'paint', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand', 'shoes', 'sports',
|
||||
'stationery', 'tailor', 'tattoo', 'ticket', 'tobacco', 'toys', 'travel_agency',
|
||||
'watches', 'weapons', 'wholesale' ]
|
||||
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']
|
||||
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']
|
||||
subclass: ['townhall', 'public_building', 'courthouse']
|
||||
community_centre:
|
||||
subclass: ['community_centre', 'social_facility']
|
||||
golf:
|
||||
subclass: ['golf', 'golf_course', 'miniature_golf']
|
||||
fast_food:
|
||||
@ -69,7 +97,7 @@ layer:
|
||||
lodging:
|
||||
subclass: ['hotel', 'motel', 'bed_and_breakfast', 'guest_house', 'hostel', 'chalet', 'alpine_hut', 'dormitory']
|
||||
ice_cream:
|
||||
subclass: ['ice_cream']
|
||||
subclass: ['ice_cream', 'ice_cream']
|
||||
post:
|
||||
subclass: ['post_box', 'post_office', 'parcel_locker']
|
||||
cafe:
|
||||
@ -82,8 +110,14 @@ layer:
|
||||
subclass: ['bar', 'nightclub']
|
||||
harbor:
|
||||
subclass: ['marina', 'dock']
|
||||
car:
|
||||
subclass: ['car', 'car_repair', 'car_parts', 'taxi']
|
||||
taxi:
|
||||
subclass: ['taxi']
|
||||
motorcycle_dealer:
|
||||
subclass: ['motorcycle']
|
||||
car_dealer:
|
||||
subclass: ['car', 'car_parts']
|
||||
car_repair:
|
||||
subclass: ['car_repair']
|
||||
hospital:
|
||||
subclass: ['hospital', 'nursing_home', 'clinic']
|
||||
cemetery:
|
||||
@ -108,6 +142,25 @@ layer:
|
||||
subclass: ['atm']
|
||||
fuel:
|
||||
subclass: ['fuel', 'charging_station']
|
||||
airport:
|
||||
subclass: [ 'aerodrome' ]
|
||||
heliport:
|
||||
subclass: [ 'helipad' ]
|
||||
wind_turbine:
|
||||
__AND__:
|
||||
subclass: [ 'generator' ]
|
||||
subtype: [ 'wind' ]
|
||||
mapping_key: [ 'power' ]
|
||||
communications_tower:
|
||||
subclass: [ 'communications_tower' ]
|
||||
water_tower:
|
||||
subclass: [ 'water_tower' ]
|
||||
wind_mill:
|
||||
subclass: [ 'wind_mill' ]
|
||||
power_tower:
|
||||
subclass: [ 'tower' ]
|
||||
industry:
|
||||
subclass: [ 'industrial' ]
|
||||
subclass:
|
||||
description: |
|
||||
Original value of either the
|
||||
|
||||
@ -98,7 +98,7 @@
|
||||
"gallery"
|
||||
]
|
||||
],
|
||||
"order": 155
|
||||
"order": 150
|
||||
},
|
||||
{
|
||||
"id": "poi_shop-z15",
|
||||
@ -165,7 +165,7 @@
|
||||
"supermarket"
|
||||
]
|
||||
],
|
||||
"order": 156
|
||||
"order": 151
|
||||
},
|
||||
{
|
||||
"id": "poi_waste",
|
||||
@ -223,7 +223,7 @@
|
||||
"toilets"
|
||||
]
|
||||
],
|
||||
"order": 157
|
||||
"order": 152
|
||||
},
|
||||
{
|
||||
"id": "poi_cemetery",
|
||||
@ -279,7 +279,7 @@
|
||||
"cemetery"
|
||||
]
|
||||
],
|
||||
"order": 158
|
||||
"order": 153
|
||||
},
|
||||
{
|
||||
"id": "poi_school",
|
||||
@ -338,7 +338,7 @@
|
||||
"school"
|
||||
]
|
||||
],
|
||||
"order": 159
|
||||
"order": 154
|
||||
},
|
||||
{
|
||||
"id": "poi_outdoor",
|
||||
@ -393,7 +393,7 @@
|
||||
"gate"
|
||||
]
|
||||
],
|
||||
"order": 160
|
||||
"order": 155
|
||||
},
|
||||
{
|
||||
"id": "poi_parking",
|
||||
@ -459,7 +459,7 @@
|
||||
"parking"
|
||||
]
|
||||
],
|
||||
"order": 161
|
||||
"order": 156
|
||||
},
|
||||
{
|
||||
"id": "poi_golf",
|
||||
@ -514,7 +514,7 @@
|
||||
"golf"
|
||||
]
|
||||
],
|
||||
"order": 162
|
||||
"order": 157
|
||||
},
|
||||
{
|
||||
"id": "poi_sport",
|
||||
@ -570,7 +570,7 @@
|
||||
"water_park"
|
||||
]
|
||||
],
|
||||
"order": 163
|
||||
"order": 158
|
||||
},
|
||||
{
|
||||
"id": "poi_ferry",
|
||||
@ -630,7 +630,7 @@
|
||||
"ferry_terminal"
|
||||
]
|
||||
],
|
||||
"order": 164
|
||||
"order": 159
|
||||
},
|
||||
{
|
||||
"id": "poi_food",
|
||||
@ -690,7 +690,7 @@
|
||||
"restaurant"
|
||||
]
|
||||
],
|
||||
"order": 165
|
||||
"order": 160
|
||||
},
|
||||
{
|
||||
"id": "poi_water",
|
||||
@ -745,7 +745,7 @@
|
||||
"ice_rink"
|
||||
]
|
||||
],
|
||||
"order": 166
|
||||
"order": 161
|
||||
},
|
||||
{
|
||||
"id": "poi_public",
|
||||
@ -833,7 +833,7 @@
|
||||
"books"
|
||||
]
|
||||
],
|
||||
"order": 167
|
||||
"order": 162
|
||||
},
|
||||
{
|
||||
"id": "poi_cultural",
|
||||
@ -899,7 +899,7 @@
|
||||
"art"
|
||||
]
|
||||
],
|
||||
"order": 168
|
||||
"order": 163
|
||||
},
|
||||
{
|
||||
"id": "poi_attraction",
|
||||
@ -954,7 +954,7 @@
|
||||
"attraction"
|
||||
]
|
||||
],
|
||||
"order": 169
|
||||
"order": 164
|
||||
},
|
||||
{
|
||||
"id": "poi_car",
|
||||
@ -1024,7 +1024,7 @@
|
||||
"charging_station"
|
||||
]
|
||||
],
|
||||
"order": 170
|
||||
"order": 165
|
||||
},
|
||||
{
|
||||
"id": "poi_health",
|
||||
@ -1082,7 +1082,7 @@
|
||||
"veterinary"
|
||||
]
|
||||
],
|
||||
"order": 171
|
||||
"order": 166
|
||||
},
|
||||
{
|
||||
"id": "poi_hospital",
|
||||
@ -1148,7 +1148,7 @@
|
||||
"hospital"
|
||||
]
|
||||
],
|
||||
"order": 172
|
||||
"order": 167
|
||||
},
|
||||
{
|
||||
"id": "poi_campsite",
|
||||
@ -1203,7 +1203,7 @@
|
||||
"campsite"
|
||||
]
|
||||
],
|
||||
"order": 173
|
||||
"order": 168
|
||||
},
|
||||
{
|
||||
"id": "poi_accommodation",
|
||||
@ -1270,7 +1270,7 @@
|
||||
"campsite"
|
||||
]
|
||||
],
|
||||
"order": 174
|
||||
"order": 169
|
||||
},
|
||||
{
|
||||
"id": "poi_place_of_worship",
|
||||
@ -1334,7 +1334,7 @@
|
||||
"place_of_worship"
|
||||
]
|
||||
],
|
||||
"order": 175
|
||||
"order": 170
|
||||
},
|
||||
{
|
||||
"id": "poi_busstop",
|
||||
@ -1395,7 +1395,7 @@
|
||||
"bus"
|
||||
]
|
||||
],
|
||||
"order": 176
|
||||
"order": 171
|
||||
},
|
||||
{
|
||||
"id": "poi_bus",
|
||||
@ -1455,7 +1455,7 @@
|
||||
"bus_stop"
|
||||
]
|
||||
],
|
||||
"order": 177
|
||||
"order": 172
|
||||
},
|
||||
{
|
||||
"id": "poi_harbor",
|
||||
@ -1505,7 +1505,7 @@
|
||||
"harbor"
|
||||
]
|
||||
],
|
||||
"order": 178
|
||||
"order": 173
|
||||
},
|
||||
{
|
||||
"id": "poi_mall",
|
||||
@ -1564,7 +1564,7 @@
|
||||
"mall"
|
||||
]
|
||||
],
|
||||
"order": 179
|
||||
"order": 174
|
||||
},
|
||||
{
|
||||
"id": "poi_train",
|
||||
@ -1623,7 +1623,7 @@
|
||||
"railway"
|
||||
]
|
||||
],
|
||||
"order": 180
|
||||
"order": 175
|
||||
},
|
||||
{
|
||||
"id": "park-local",
|
||||
@ -1683,7 +1683,7 @@
|
||||
"park"
|
||||
]
|
||||
],
|
||||
"order": 194
|
||||
"order": 189
|
||||
},
|
||||
{
|
||||
"id": "poi_zoo",
|
||||
@ -1743,7 +1743,7 @@
|
||||
"zoo"
|
||||
]
|
||||
],
|
||||
"order": 196
|
||||
"order": 191
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -109,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
|
||||
|
||||
@ -7698,7 +7698,7 @@
|
||||
"path"
|
||||
]
|
||||
],
|
||||
"order": 181
|
||||
"order": 176
|
||||
},
|
||||
{
|
||||
"id": "road_oneway",
|
||||
@ -7748,7 +7748,7 @@
|
||||
"service"
|
||||
]
|
||||
],
|
||||
"order": 182
|
||||
"order": 177
|
||||
},
|
||||
{
|
||||
"id": "road_oneway_opposite",
|
||||
@ -7799,7 +7799,7 @@
|
||||
"service"
|
||||
]
|
||||
],
|
||||
"order": 183
|
||||
"order": 178
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -144,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,
|
||||
@ -163,6 +165,13 @@ CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z11(
|
||||
);
|
||||
|
||||
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,
|
||||
@ -170,6 +179,8 @@ ALTER TABLE osm_transportation_merge_linestring_gen_z11 ADD COLUMN IF NOT EXISTS
|
||||
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
|
||||
@ -469,6 +480,8 @@ CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z8(
|
||||
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,
|
||||
@ -480,6 +493,13 @@ CREATE TABLE IF NOT EXISTS osm_transportation_merge_linestring_gen_z8(
|
||||
);
|
||||
|
||||
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,
|
||||
@ -487,6 +507,8 @@ ALTER TABLE osm_transportation_merge_linestring_gen_z8 ADD COLUMN IF NOT EXISTS
|
||||
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
|
||||
@ -1116,11 +1138,6 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- Create temporary Merged-LineString to Source-LineStrings-ID columns to store relations before they have been
|
||||
-- intersected
|
||||
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[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
INSERT INTO osm_transportation_merge_linestring_gen_z11(geometry, new_source_ids, old_source_ids, highway,
|
||||
@ -1180,9 +1197,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z11 DROP COLUMN IF EXISTS new_source_ids;
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z11 DROP COLUMN IF EXISTS old_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;
|
||||
@ -1414,9 +1431,6 @@ BEGIN
|
||||
|
||||
-- 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 new_source_ids INT[];
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z8 ADD COLUMN IF NOT EXISTS old_source_ids INT[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
INSERT INTO osm_transportation_merge_linestring_gen_z8(geometry, new_source_ids, old_source_ids, highway,
|
||||
@ -1466,10 +1480,10 @@ BEGIN
|
||||
-- Cleanup
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z8 DROP COLUMN IF EXISTS new_source_ids;
|
||||
ALTER TABLE osm_transportation_merge_linestring_gen_z8 DROP COLUMN IF EXISTS old_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
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
"ferry"
|
||||
]
|
||||
],
|
||||
"order": 184
|
||||
"order": 179
|
||||
},
|
||||
{
|
||||
"id": "road_label",
|
||||
@ -81,7 +81,7 @@
|
||||
"ferry"
|
||||
]
|
||||
],
|
||||
"order": 185
|
||||
"order": 180
|
||||
},
|
||||
{
|
||||
"id": "highway-shield-tertiary",
|
||||
@ -160,7 +160,7 @@
|
||||
"ref"
|
||||
]
|
||||
],
|
||||
"order": 186
|
||||
"order": 181
|
||||
},
|
||||
{
|
||||
"id": "highway-shield-secondary",
|
||||
@ -239,7 +239,7 @@
|
||||
"ref"
|
||||
]
|
||||
],
|
||||
"order": 187
|
||||
"order": 182
|
||||
},
|
||||
{
|
||||
"id": "highway-shield-primary",
|
||||
@ -318,7 +318,7 @@
|
||||
"ref"
|
||||
]
|
||||
],
|
||||
"order": 188
|
||||
"order": 183
|
||||
},
|
||||
{
|
||||
"id": "highway-shield-motorway",
|
||||
@ -400,7 +400,7 @@
|
||||
"ref"
|
||||
]
|
||||
],
|
||||
"order": 189
|
||||
"order": 184
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -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,
|
||||
@ -62,6 +64,15 @@ CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring(
|
||||
);
|
||||
|
||||
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,
|
||||
@ -1102,11 +1113,6 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- 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[];
|
||||
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
@ -1154,9 +1160,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
ALTER TABLE osm_transportation_name_linestring DROP COLUMN IF EXISTS new_source_ids;
|
||||
ALTER TABLE osm_transportation_name_linestring DROP COLUMN IF EXISTS old_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;
|
||||
@ -1290,10 +1296,6 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- 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[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
@ -1336,9 +1338,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
ALTER TABLE osm_transportation_name_linestring DROP COLUMN IF EXISTS new_source_ids;
|
||||
ALTER TABLE osm_transportation_name_linestring DROP COLUMN IF EXISTS old_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;
|
||||
@ -1472,10 +1474,6 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- 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[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
@ -1518,9 +1516,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
ALTER TABLE osm_transportation_name_linestring DROP COLUMN IF EXISTS new_source_ids;
|
||||
ALTER TABLE osm_transportation_name_linestring DROP COLUMN IF EXISTS old_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;
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
"LineString"
|
||||
]
|
||||
],
|
||||
"order": 152
|
||||
"order": 147
|
||||
},
|
||||
{
|
||||
"id": "water_name_point",
|
||||
@ -68,7 +68,7 @@
|
||||
"ocean"
|
||||
]
|
||||
],
|
||||
"order": 153
|
||||
"order": 148
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -93,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
|
||||
|
||||
@ -367,7 +367,7 @@
|
||||
"LineString"
|
||||
]
|
||||
],
|
||||
"order": 151
|
||||
"order": 146
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -21,6 +21,8 @@ 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,
|
||||
@ -28,6 +30,15 @@ CREATE TABLE IF NOT EXISTS osm_important_waterway_linestring (
|
||||
);
|
||||
|
||||
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
|
||||
@ -35,6 +46,8 @@ ALTER TABLE osm_important_waterway_linestring ADD COLUMN IF NOT EXISTS source_id
|
||||
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
|
||||
@ -478,10 +491,6 @@ BEGIN
|
||||
CREATE INDEX ON clustered_linestrings_to_merge (cluster_group, cluster);
|
||||
ANALYZE clustered_linestrings_to_merge;
|
||||
|
||||
-- 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[];
|
||||
|
||||
WITH inserted_linestrings AS (
|
||||
-- Merge LineStrings of each cluster and insert them
|
||||
@ -527,9 +536,9 @@ BEGIN
|
||||
-- Cleanup remaining table
|
||||
DROP TABLE clustered_linestrings_to_merge;
|
||||
|
||||
-- Drop temporary Merged-LineString to Source-LineStrings-ID columns
|
||||
ALTER TABLE osm_important_waterway_linestring DROP COLUMN IF EXISTS new_source_ids;
|
||||
ALTER TABLE osm_important_waterway_linestring DROP COLUMN IF EXISTS old_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;
|
||||
@ -549,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
|
||||
|
||||
BIN
miel_screenshot.png
Normal file
BIN
miel_screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 765 KiB |
@ -7,6 +7,7 @@ tileset:
|
||||
- layers/mountain_peak/mountain_peak.yaml
|
||||
- layers/park/park.yaml
|
||||
- layers/boundary/boundary.yaml
|
||||
- layers/boundary/nuts.yaml
|
||||
- layers/aeroway/aeroway.yaml
|
||||
- layers/transportation/transportation.yaml
|
||||
- layers/building/building.yaml
|
||||
@ -15,6 +16,7 @@ tileset:
|
||||
- layers/place/place.yaml
|
||||
- layers/housenumber/housenumber.yaml
|
||||
- layers/poi/poi.yaml
|
||||
- layers/landmarks/landmark.yaml
|
||||
- layers/aerodrome_label/aerodrome_label.yaml
|
||||
name: OpenMapTiles
|
||||
version: 3.15.0
|
||||
@ -98,6 +100,7 @@ tileset:
|
||||
- ta # Tamil
|
||||
- te # Telugu
|
||||
- th # Thai
|
||||
- tok # Toki Pona
|
||||
- tr # Turkish, Latin
|
||||
- uk # Ukrainian
|
||||
- ur # Urdu
|
||||
|
||||
46
test.sh
Executable file
46
test.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Test script for generating tiles for Lummen and region (e.g. including Hasselt)
|
||||
export SOURCE=osmfr
|
||||
export AREA=europe/belgium/flanders
|
||||
export BBOX=4.964926,50.882471,5.411252,51.071236
|
||||
# Which zooms to generate in make generate-tiles
|
||||
export MIN_ZOOM=0
|
||||
export MAX_ZOOM=16
|
||||
|
||||
# Update the .env to match
|
||||
sed -i "s/MIN_ZOOM=.*/MIN_ZOOM=${MIN_ZOOM}/" .env
|
||||
sed -i "s/MAX_ZOOM=.*/MAX_ZOOM=${MAX_ZOOM}/" .env
|
||||
sed -i "s/BBOX=.*/BBOX=${BBOX}/" .env
|
||||
|
||||
|
||||
# Setup
|
||||
make clean
|
||||
make DC_OPTS=--rm
|
||||
|
||||
# Start from a clean db
|
||||
make start-db
|
||||
make destroy-db
|
||||
make import-data
|
||||
# ALTERNATIVE would be this
|
||||
#make start-db-preloaded
|
||||
|
||||
# Download
|
||||
make download-${SOURCE} area="${AREA}"
|
||||
|
||||
# Import (yes we're doing import borders twice, it crashes on first run, oddly enough)
|
||||
make import-osm
|
||||
make import-wikidata
|
||||
make import-borders || true
|
||||
make import-sql
|
||||
make analyze-db
|
||||
|
||||
# (This potentially screws stuff up?!)
|
||||
#rm -rf data/${AREA}.dc-config.yml
|
||||
#make generate-dc-config
|
||||
|
||||
# Generate
|
||||
make generate-tiles-pg
|
||||
|
||||
make stop-db
|
||||
Loading…
x
Reference in New Issue
Block a user