Porównaj commity
114 Commity
Autor | SHA1 | Data |
---|---|---|
Tomas Pohanka | 1ff5145451 | |
Tomas Pohanka | e6faa69a70 | |
Tomas Pohanka | eae7d7e1ed | |
Tomas Pohanka | 382b12ae8a | |
Tomas Pohanka | 59692656bd | |
Tomas Pohanka | ee19519905 | |
Tomas Pohanka | 8266197149 | |
zstadler | 3f0ba7ceba | |
Adam Laža | c2ae2503c8 | |
Tomas Pohanka | d709a51de6 | |
Brian Sperlongano | af6dc684ef | |
Adam Laža | 136e1db4d1 | |
Tomas Pohanka | 585b71f666 | |
Brian Sperlongano | d6fd5ef7cb | |
Andrea Mennillo | 9f891b625a | |
Tomas Pohanka | 5b00c496ef | |
Adam Laža | a65495f264 | |
Andrea Mennillo | 2f170fbbd8 | |
Tomas Pohanka | de2fa04c37 | |
Tomas Pohanka | 44cf6c8e35 | |
Tomas Pohanka | b057d5941e | |
Brian Sperlongano | b3c32321a3 | |
Andrea Mennillo | ee8259ced5 | |
Tomas Pohanka | 718fd359d3 | |
Michał Gwóźdź | 8d6b95008d | |
Michał Gwóźdź | aa51a6c101 | |
Makien Osman | d54ce2e617 | |
Brian Sperlongano | 5fd186a311 | |
Tomas Pohanka | 6d1cb63d8e | |
Peter Hanecak | fe61912c09 | |
Peter Hanecak | bb154f4ee8 | |
Brian Sperlongano | e29827d76c | |
Tomas Pohanka | eb7f6be455 | |
Brian Sperlongano | a682d50d0d | |
Brian Sperlongano | d3a9b36873 | |
Brian Sperlongano | b9c9e69028 | |
Christopher Beddow | e61442c49d | |
Martin Fischer | 3cf77e2a54 | |
Brian Sperlongano | 6c31841f46 | |
Zhongxiang Wang | dfd20c647c | |
Michał Gwóźdź | febd1abbd2 | |
Brian Sperlongano | 9de3ff3921 | |
Brian Sperlongano | a7a50d84bc | |
Brian Sperlongano | 48a2b1af72 | |
Peter Hanecak | 0ca096938e | |
benedikt-brandtner-bikemap | a8e6573ba8 | |
Tomas Pohanka | 103e37bd2c | |
Andrea Mennillo | a548093e08 | |
benedikt-brandtner-bikemap | 66731f3544 | |
benedikt-brandtner-bikemap | d8a264cd0c | |
benedikt-brandtner-bikemap | d0d87e52d5 | |
Christopher Beddow | 80bc6518ab | |
Yaser Kalali | 692b0a7afe | |
Brian Sperlongano | aea2b734da | |
William Edmisten | 5153dffe4a | |
Brian Sperlongano | 9969c5c741 | |
benedikt-brandtner-bikemap | 91dd853a89 | |
Brian Sperlongano | b3d67ed5b3 | |
Brian Sperlongano | 6f2b39e657 | |
benedikt-brandtner-bikemap | f3dbb0a839 | |
benedikt-brandtner-bikemap | 54e24207a1 | |
benedikt-brandtner-bikemap | d937705292 | |
benedikt-brandtner-bikemap | b2a57b3755 | |
benedikt-brandtner-bikemap | 8321574565 | |
benedikt-brandtner-bikemap | 0e8e2512e8 | |
benedikt-brandtner-bikemap | 3caa11aee9 | |
benedikt-brandtner-bikemap | 1126e30d0d | |
benedikt-brandtner-bikemap | d97d86320b | |
benedikt-brandtner-bikemap | 7bdf1ae409 | |
benedikt-brandtner-bikemap | d8a8c81f79 | |
benedikt-brandtner-bikemap | f918f4d607 | |
Brian Sperlongano | 81d29fff2b | |
William Edmisten | 02dcc41e1f | |
Brian Sperlongano | e5a5acfa99 | |
Brian Sperlongano | d8c367f42c | |
Brian Sperlongano | 0c6dd1fecb | |
Brian Sperlongano | b7edcf6153 | |
Tomas Pohanka | 624cf7a8a3 | |
Brian Sperlongano | 5e9b7c475d | |
Tomas Pohanka | d2c69b0d45 | |
Brian Sperlongano | bc9bbd2e67 | |
Brian Sperlongano | efa6b27fba | |
Brian Sperlongano | f9e358c962 | |
ttomasz | 3b4650fca1 | |
Brian Sperlongano | 168e8300c0 | |
Brian Sperlongano | edb42f2db3 | |
Brian Sperlongano | 8b5aa3273e | |
James Westman | 569e9cd5b4 | |
Brian Sperlongano | 5f7b2c11b3 | |
Brian Sperlongano | af8c6883dd | |
Daniel Schep | cd77b07e46 | |
Brian Sperlongano | 4d5fa84184 | |
Brian Sperlongano | 29e49f9424 | |
Brian Sperlongano | c4d86d44a6 | |
Adam Laža | aa9c39ba3b | |
Brian Sperlongano | ca4a64ba72 | |
Thomas Helmrich | 567939b5ce | |
Tomas Pohanka | 4cb65b0a4f | |
Adam Laža | f21b677083 | |
Tomas Pohanka | cd0ffacc72 | |
bgo-eiu | 6212c056ea | |
Tomas Pohanka | 6e73058a23 | |
Tomas Pohanka | e079e82cb1 | |
Tomas Pohanka | 029033a593 | |
Tomas Pohanka | b14da2eafb | |
Tomas Pohanka | dae00f2604 | |
zstadler | 1c1231e430 | |
Clay Smalley | 337f81284d | |
Brian Sperlongano | 5e51627895 | |
Brian Sperlongano | 9c78c15943 | |
SahAssar | dc1e21fccc | |
Jeroen Hoek | da7b1b1645 | |
Ryan Russell | b3af3d47d6 | |
ttomasz | 82b00c1389 |
14
.env
|
@ -3,8 +3,8 @@
|
|||
# Layers definition and meta data
|
||||
TILESET_FILE=openmaptiles.yaml
|
||||
|
||||
# Use 3-part patch version to ignore patch updates, e.g. 5.0.0
|
||||
TOOLS_VERSION=6.2
|
||||
# Use 3-part patch version to ignore patch updates, e.g. 7.0.0
|
||||
TOOLS_VERSION=7.1
|
||||
|
||||
# Make sure these values are in sync with the ones in .env-postgres file
|
||||
PGDATABASE=openmaptiles
|
||||
|
@ -29,21 +29,13 @@ MAX_ZOOM=7
|
|||
# Use true (case sensitive) to allow data updates
|
||||
DIFF_MODE=false
|
||||
|
||||
# Some area data like openstreetmap.fr can contain invalid references
|
||||
# that must be cleaned up before using it for borders -- set it to true.
|
||||
BORDERS_CLEANUP=false
|
||||
|
||||
# The current setup assumes this file is placed inside the data/ dir
|
||||
MBTILES_FILE=tiles.mbtiles
|
||||
|
||||
# This is the current repl_config.json location, pre-configured in the tools Dockerfile
|
||||
# Makefile and quickstart replace it with the dynamically generated one, but we keep it here in case some other method is used to run.
|
||||
IMPOSM_CONFIG_FILE=/usr/src/app/config/repl_config.json
|
||||
|
||||
# import-borders temp files - set them here to defaults, and override in the Makefile based on the area
|
||||
BORDERS_CLEANUP_FILE=data/borders/cleanup.pbf
|
||||
BORDERS_PBF_FILE=data/borders/filtered.pbf
|
||||
BORDERS_CSV_FILE=data/borders/lines.csv
|
||||
|
||||
# Number of parallel processes to use when importing sql files
|
||||
MAX_PARALLEL_PSQL=5
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ jobs:
|
|||
steps:
|
||||
|
||||
- name: Checkout the changes
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run quickstart for a small area
|
||||
env:
|
||||
|
@ -27,7 +27,7 @@ jobs:
|
|||
./quickstart.sh $area
|
||||
|
||||
- name: Save quickstart.log
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: quickstart.log
|
||||
path: quickstart.log
|
||||
|
|
|
@ -45,7 +45,7 @@ jobs:
|
|||
|
||||
- name: Cache test data download
|
||||
id: cache-testdata
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ci_cache
|
||||
key: "v2-${{ env.TEST_DATA_URL }}"
|
||||
|
@ -58,7 +58,7 @@ jobs:
|
|||
curl --silent --show-error --location --output ci_cache/perf-test-areas-latest.osm.pbf "$TEST_DATA_URL"
|
||||
|
||||
- name: Get code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Fetch the last two commits in case this is a PR,
|
||||
# and we need to profile the base branch first
|
||||
|
@ -76,10 +76,10 @@ jobs:
|
|||
# Take the first parent of the grafted commit (cannot use HEAD^1 with shallow clones)
|
||||
REV_HASH=$(git cat-file -p $REV_HASH | awk 'NR > 1 {if(/^parent/){print $2; exit}}')
|
||||
fi
|
||||
echo "::set-output name=hash::$REV_HASH"
|
||||
echo "hash=$REV_HASH" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up caching for the performance results
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: perf_cache
|
||||
# If profiling result cache has incompatible format, increase this "v" number
|
||||
|
@ -287,14 +287,14 @@ jobs:
|
|||
fi
|
||||
|
||||
- name: Save performance artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: performance_results
|
||||
path: artifacts
|
||||
|
||||
- name: Save PR message artifact
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: pr_message
|
||||
path: pr_message
|
||||
|
|
|
@ -15,7 +15,7 @@ jobs:
|
|||
steps:
|
||||
|
||||
- name: Checkout the changes
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Introduction
|
||||
|
||||
Thank you for considering contributing to OpenMapTiles. It's people like you that make OpenMapTiles such a great project. Talk to us at the OSM Slack **#openmaptiles** channel ([join](https://osmus-slack.herokuapp.com/)).
|
||||
Thank you for considering contributing to OpenMapTiles. It's people like you that make OpenMapTiles such a great project. Talk to us at the OSM Slack **#openmaptiles** channel ([join](https://slack.openstreetmap.us/)).
|
||||
|
||||
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2021, MapTiler.com & OpenMapTiles contributors.
|
||||
Copyright (c) 2024, MapTiler.com & OpenMapTiles contributors.
|
||||
All rights reserved.
|
||||
|
||||
The vector tile schema has been developed by Klokan Technologies GmbH and
|
||||
|
|
79
Makefile
|
@ -22,14 +22,26 @@ export PPORT
|
|||
# Local port to use with tileserver
|
||||
TPORT ?= 8080
|
||||
export TPORT
|
||||
STYLE_FILE := build/style/style.json
|
||||
STYLE_HEADER_FILE := style/style-header.json
|
||||
|
||||
# Support newer `docker compose` syntax in addition to `docker-compose`
|
||||
|
||||
ifeq (, $(shell which docker-compose))
|
||||
DOCKER_COMPOSE_COMMAND := docker compose
|
||||
$(info Using docker compose V2 (docker compose))
|
||||
else
|
||||
DOCKER_COMPOSE_COMMAND := docker-compose
|
||||
$(info Using docker compose V1 (docker-compose))
|
||||
endif
|
||||
|
||||
# Allow a custom docker-compose project name
|
||||
DC_PROJECT := $(or $(DC_PROJECT),$(shell (. .env; echo $${DC_PROJECT})))
|
||||
ifeq ($(DC_PROJECT),)
|
||||
DC_PROJECT := $(notdir $(shell pwd))
|
||||
DOCKER_COMPOSE := docker-compose
|
||||
DOCKER_COMPOSE := $(DOCKER_COMPOSE_COMMAND)
|
||||
else
|
||||
DOCKER_COMPOSE := docker-compose --project-name $(DC_PROJECT)
|
||||
DOCKER_COMPOSE := $(DOCKER_COMPOSE_COMMAND) --project-name $(DC_PROJECT)
|
||||
endif
|
||||
|
||||
# Make some operations quieter (e.g. inside the test script)
|
||||
|
@ -164,7 +176,7 @@ TPORT := $(or $(TPORT),$(shell (. .env; echo $${TPORT})),7)
|
|||
|
||||
define HELP_MESSAGE
|
||||
==============================================================================
|
||||
OpenMapTiles https://github.com/openmaptiles/openmaptiles
|
||||
OpenMapTiles https://github.com/openmaptiles/openmaptiles
|
||||
|
||||
Hints for testing areas
|
||||
make list-geofabrik # list actual geofabrik OSM extracts for download -> <<your-area>>
|
||||
|
@ -186,6 +198,7 @@ Hints for developers:
|
|||
make generate-qa # statistics for a given layer's field
|
||||
make generate-tiles-pg # generate vector tiles based on .env settings using PostGIS ST_MVT()
|
||||
make generate-tiles # generate vector tiles based on .env settings using Mapnik (obsolete)
|
||||
make generate-changed-tiles # Generate tiles changed by import-diff
|
||||
make test-sql # run unit tests on the OpenMapTiles SQL schema
|
||||
cat .env # list PG database and MIN_ZOOM and MAX_ZOOM information
|
||||
cat quickstart.log # transcript of the last ./quickstart.sh run
|
||||
|
@ -200,6 +213,7 @@ Hints for downloading & importing data:
|
|||
make download-bbbike area=Amsterdam # download OSM data from bbbike.org and create config file
|
||||
make import-data # Import data from OpenStreetMapData, Natural Earth and OSM Lake Labels.
|
||||
make import-osm # Import OSM data with the mapping rules from build/mapping.yaml
|
||||
make import-diff # Import OSM updates from data/changes.osc.gz
|
||||
make import-wikidata # Import labels from Wikidata
|
||||
make import-sql # Import layers (run this after modifying layer SQL)
|
||||
|
||||
|
@ -229,7 +243,7 @@ export HELP_MESSAGE
|
|||
#
|
||||
|
||||
.PHONY: all
|
||||
all: init-dirs build/openmaptiles.tm2source/data.yml build/mapping.yaml build-sql
|
||||
all: init-dirs build/openmaptiles.tm2source/data.yml build/mapping.yaml build-sql build-style
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
|
@ -251,6 +265,7 @@ endef
|
|||
init-dirs:
|
||||
@mkdir -p build/sql/parallel
|
||||
@mkdir -p build/openmaptiles.tm2source
|
||||
@mkdir -p build/style
|
||||
@mkdir -p data
|
||||
@mkdir -p cache
|
||||
@ ! ($(DOCKER_COMPOSE) 2>/dev/null run $(DC_OPTS) openmaptiles-tools df --output=fstype /tileset| grep -q 9p) < /dev/null || ($(win_fs_error))
|
||||
|
@ -274,10 +289,29 @@ ifeq (,$(wildcard build/sql/run_last.sql))
|
|||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c \
|
||||
'generate-sql $(TILESET_FILE) --dir ./build/sql \
|
||||
&& generate-sqltomvt $(TILESET_FILE) \
|
||||
--key --gzip --postgis-ver 3.0.1 \
|
||||
--key --gzip --postgis-ver 3.3.4 \
|
||||
--function --fname=getmvt >> ./build/sql/run_last.sql'
|
||||
endif
|
||||
|
||||
.PHONY: build-sprite
|
||||
build-sprite: init-dirs
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c 'spreet /style/icons build/style/sprite && \
|
||||
spreet --retina /style/icons build/style/sprite@2x'
|
||||
|
||||
.PHONY: build-style
|
||||
build-style: init-dirs
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c 'style-tools recompose $(TILESET_FILE) $(STYLE_FILE) \
|
||||
$(STYLE_HEADER_FILE) && \
|
||||
spreet /style/icons build/style/sprite && spreet --retina /style/icons build/style/sprite@2x'
|
||||
|
||||
.PHONY: download-fonts
|
||||
download-fonts:
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools bash -c '[ ! -d "/export/fonts" ] && mkdir /export/fonts && \
|
||||
echo "Downloading fonts..." && wget -qO /export/noto-sans.zip --show-progress \
|
||||
https://github.com/openmaptiles/fonts/releases/download/v2.0/noto-sans.zip && \
|
||||
echo "Unzipping fonts..." && unzip -q /export/noto-sans.zip -d /export/fonts && rm /export/noto-sans.zip || \
|
||||
echo "Fonts already exist."'
|
||||
|
||||
.PHONY: clean
|
||||
clean: clean-test-data
|
||||
rm -rf build
|
||||
|
@ -397,7 +431,7 @@ import-osm: all start-db-nowait
|
|||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && import-osm $(PBF_FILE)'
|
||||
|
||||
.PHONY: start-update-osm
|
||||
start-update-osm: all start-db
|
||||
start-update-osm: start-db
|
||||
@$(assert_area_is_given)
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) up -d update-osm
|
||||
|
||||
|
@ -406,7 +440,7 @@ stop-update-osm:
|
|||
$(DOCKER_COMPOSE) stop update-osm
|
||||
|
||||
.PHONY: import-diff
|
||||
import-diff: all start-db-nowait
|
||||
import-diff: start-db-nowait
|
||||
@$(assert_area_is_given)
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && import-diff'
|
||||
|
||||
|
@ -440,8 +474,23 @@ generate-tiles-pg: all start-db
|
|||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools \
|
||||
mbtiles-tools meta-generate "$(MBTILES_LOCAL_FILE)" $(TILESET_FILE) --auto-minmax --show-ranges
|
||||
|
||||
.PHONY: data/tiles.txt
|
||||
data/tiles.txt:
|
||||
find ./data -name "*.tiles" -exec cat {} \; -exec rm {} \; | \
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) openmaptiles-tools \
|
||||
tile_multiplier $(MIN_ZOOM) $(MAX_ZOOM) >> data/tiles.txt
|
||||
|
||||
.PHONY: generate-changed-tiles
|
||||
generate-changed-tiles: data/tiles.txt
|
||||
# Re-generating updated tiles, if needed
|
||||
if [ -s data/tiles.txt ] ; then \
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools refresh-views; \
|
||||
$(DOCKER_COMPOSE) run $(DC_OPTS) -e LIST_FILE=data/tiles.txt openmaptiles-tools generate-tiles; \
|
||||
rm data/tiles.txt; \
|
||||
fi
|
||||
|
||||
.PHONY: start-tileserver
|
||||
start-tileserver: init-dirs
|
||||
start-tileserver: init-dirs build-style download-fonts
|
||||
@echo " "
|
||||
@echo "***********************************************************"
|
||||
@echo "* "
|
||||
|
@ -450,7 +499,7 @@ start-tileserver: init-dirs
|
|||
@echo "* "
|
||||
@echo "***********************************************************"
|
||||
@echo " "
|
||||
docker pull maptiler/tileserver-gl
|
||||
$(DOCKER_COMPOSE_COMMAND) pull tileserver-gl
|
||||
@echo " "
|
||||
@echo "***********************************************************"
|
||||
@echo "* "
|
||||
|
@ -567,9 +616,9 @@ else
|
|||
@echo "Refreshing docker images... Use NO_REFRESH=1 to skip."
|
||||
ifneq ($(USE_PRELOADED_IMAGE),)
|
||||
POSTGIS_IMAGE=openmaptiles/postgis-preloaded \
|
||||
docker-compose pull --ignore-pull-failures $(QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres
|
||||
$(DOCKER_COMPOSE_COMMAND) pull --ignore-pull-failures $(QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres
|
||||
else
|
||||
docker-compose pull --ignore-pull-failures $(QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres import-data
|
||||
$(DOCKER_COMPOSE_COMMAND) pull --ignore-pull-failures $(QUIET_FLAG) openmaptiles-tools generate-vectortiles postgres import-data
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -594,7 +643,7 @@ test-perf-null: init-dirs
|
|||
|
||||
.PHONY: build-test-pbf
|
||||
build-test-pbf: init-dirs
|
||||
docker-compose run $(DC_OPTS) openmaptiles-tools /tileset/.github/workflows/build-test-data.sh
|
||||
$(DOCKER_COMPOSE_COMMAND) run $(DC_OPTS) openmaptiles-tools /tileset/.github/workflows/build-test-data.sh
|
||||
|
||||
.PHONY: debug
|
||||
debug: ## Use this target when developing Makefile itself to verify loaded environment variables
|
||||
|
@ -636,11 +685,13 @@ test-sql: clean refresh-docker-images destroy-db start-db-nowait build/import-te
|
|||
awk '1{print; fflush()} $$0~".*ERROR" {txt=$$0} END{ if(txt){print "\n*** ERROR detected, aborting:"; print txt; exit(1)} }'
|
||||
|
||||
@echo "Test SQL output for Import Test Data"
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-import.sql'
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-import.sql' 2>&1 | \
|
||||
awk -v s="ERROR:" '1{print; fflush()} $$0~s{print "*** ERROR detected, aborting"; exit(1)}'
|
||||
|
||||
@echo "Run UPDATE process on test data..."
|
||||
sed -ir "s/^[#]*\s*DIFF_MODE=.*/DIFF_MODE=true/" .env
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && import-diff'
|
||||
|
||||
@echo "Test SQL output for Update Test Data"
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-update.sql'
|
||||
$(DOCKER_COMPOSE) $(DC_CONFIG_CACHE) run $(DC_OPTS_CACHE) openmaptiles-tools sh -c 'pgwait && psql.sh < tests/test-post-update.sql' 2>&1 | \
|
||||
awk -v s="ERROR:" '1{print; fflush()} $$0~s{print "*** ERROR detected, aborting"; exit(1)}'
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
### Req:
|
||||
* CPU: AMD64 ( = Intel 64 bit)
|
||||
* The base docker debian images are x86_64 based, so the ARM,MIPS currently not supported!
|
||||
* The base docker debian images are x86_64 based, so the ARM, MIPS currently not supported!
|
||||
* Operating system
|
||||
* Linux is suggested
|
||||
* The development and the testing platform is Linux.
|
||||
|
@ -423,9 +423,11 @@ Hints for testing areas
|
|||
|
||||
Hints for designers:
|
||||
make start-maputnik # start Maputnik Editor + dynamic tile server [ see http://localhost:8088 ]
|
||||
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 stop-tileserver # stop maptiler/tileserver-gl
|
||||
|
||||
Hints for developers:
|
||||
make # build source code
|
||||
|
@ -435,6 +437,7 @@ Hints for developers:
|
|||
make generate-qa # statistics for a given layer's field
|
||||
make generate-tiles-pg # generate vector tiles based on .env settings using PostGIS ST_MVT()
|
||||
make generate-tiles # generate vector tiles based on .env settings using Mapnik (obsolete)
|
||||
make generate-changed-tiles # Generate tiles changed by import-diff
|
||||
make test-sql # run unit tests on the OpenMapTiles SQL schema
|
||||
cat .env # list PG database and MIN_ZOOM and MAX_ZOOM information
|
||||
cat quickstart.log # transcript of the last ./quickstart.sh run
|
||||
|
@ -449,6 +452,7 @@ Hints for downloading & importing data:
|
|||
make download-bbbike area=Amsterdam # download OSM data from bbbike.org and create config file
|
||||
make import-data # Import data from OpenStreetMapData, Natural Earth and OSM Lake Labels.
|
||||
make import-osm # Import OSM data with the mapping rules from build/mapping.yaml
|
||||
make import-diff # Import OSM updates from data/changes.osc.gz
|
||||
make import-wikidata # Import labels from Wikidata
|
||||
make import-sql # Import layers (run this after modifying layer SQL)
|
||||
|
||||
|
|
46
README.md
|
@ -1,4 +1,4 @@
|
|||
## OpenMapTiles [![Build Status](https://github.com/openmaptiles/openmaptiles/workflows/OMT_CI/badge.svg?branch=master)](https://github.com/openmaptiles/openmaptiles/actions)
|
||||
## OpenMapTiles [![Build Status](https://github.com/openmaptiles/openmaptiles/workflows/OpenMapTiles%20Integrity%20CI/badge.svg?branch=master)](https://github.com/openmaptiles/openmaptiles/actions)
|
||||
|
||||
OpenMapTiles is an extensible and open tile schema based on the OpenStreetMap. This project is used to generate vector tiles for online zoomable maps. OpenMapTiles is about creating a beautiful basemaps with general layers containing topographic information. More information [openmaptiles.org](https://openmaptiles.org/) and [maptiler.com/data/](https://www.maptiler.com/data/).
|
||||
|
||||
|
@ -11,7 +11,8 @@ Please keep in mind that OpenMapTiles schema should display general topographic
|
|||
- :link: Data for download: https://www.maptiler.com/data/
|
||||
- :link: Hosting https://www.maptiler.com/cloud/
|
||||
- :link: Create own layer https://github.com/openmaptiles/openmaptiles-skiing
|
||||
- :link: Discuss at the #openmaptiles channel at [OSM Slack](https://osmus-slack.herokuapp.com/)
|
||||
- :link: Practical usage of OpenMapTiles https://github.com/maptiler/foss4g-workshop
|
||||
- :link: Discuss at the #openmaptiles channel at [OSM Slack](https://slack.openstreetmap.us/)
|
||||
|
||||
## Styles
|
||||
|
||||
|
@ -20,14 +21,15 @@ You can start from several GL styles supporting the OpenMapTiles vector schema.
|
|||
:link: [Learn how to create Mapbox GL styles with Maputnik and OpenMapTiles](http://openmaptiles.org/docs/style/maputnik/).
|
||||
|
||||
|
||||
- [OSM OpenMapTiles](./style/README.md)
|
||||
- [OSM Bright](https://github.com/openmaptiles/osm-bright-gl-style)
|
||||
- [MapTiler Basic](https://github.com/openmaptiles/maptiler-basic-gl-style)
|
||||
- [MapTiler 3D](https://github.com/openmaptiles/maptiler-3d-gl-style)
|
||||
- [Fiord Color](https://github.com/openmaptiles/fiord-color-gl-style)
|
||||
- [MapTiler Toner](https://github.com/openmaptiles/maptiler-toner-gl-style)
|
||||
- [OSM Liberty](https://github.com/maputnik/osm-liberty)
|
||||
- [Positron](https://github.com/openmaptiles/positron-gl-style)
|
||||
- [Dark Matter](https://github.com/openmaptiles/dark-matter-gl-style)
|
||||
- [Klokantech Basic](https://github.com/openmaptiles/klokantech-basic-gl-style)
|
||||
- [Klokantech 3D](https://github.com/openmaptiles/klokantech-3d-gl-style)
|
||||
- [Fiord Color](https://github.com/openmaptiles/fiord-color-gl-style)
|
||||
- [Toner](https://github.com/openmaptiles/toner-gl-style)
|
||||
- [OSM Liberty](https://github.com/maputnik/osm-liberty)
|
||||
|
||||
We also ported over our favorite old raster styles (TM2).
|
||||
|
||||
|
@ -87,7 +89,7 @@ make
|
|||
```
|
||||
|
||||
You can execute the following manual steps (for better understanding)
|
||||
or use the provided `quickstart.sh` script to automatically download and import given area. If area is not given, albania will be imported.
|
||||
or use the provided `quickstart.sh` script to automatically download and import given area. If area is not given, Albania will be imported. List of available areas `make list-geofabrik`.
|
||||
|
||||
```
|
||||
./quickstart.sh <area>
|
||||
|
@ -101,7 +103,7 @@ Now start up the database container.
|
|||
make start-db
|
||||
```
|
||||
|
||||
Import external data from [OpenStreetMapData](http://osmdata.openstreetmap.de/), [Natural Earth](http://www.naturalearthdata.com/) and [OpenStreetMap Lake Labels](https://github.com/lukasmartinelli/osm-lakelines). Natural Earth country boundaries are used in the few lowest zoom levels.
|
||||
Import external data from [OpenStreetMapData](http://osmdata.openstreetmap.de/), [Natural Earth](http://www.naturalearthdata.com/) and [OpenStreetMap Lake Labels](https://github.com/openmaptiles/osm-lakelines). Natural Earth country boundaries are used in the few lowest zoom levels.
|
||||
|
||||
```bash
|
||||
make import-data
|
||||
|
@ -113,8 +115,8 @@ Download OpenStreetMap data extracts from any source like [Geofabrik](http://dow
|
|||
make download area=albania
|
||||
```
|
||||
|
||||
[Import OpenStreetMap data](https://github.com/openmaptiles/openmaptiles-tools/tree/master/docker/import-osm) with the mapping rules from
|
||||
`build/mapping.yaml` (which has been created by `make`). Run after any change in layers definition.
|
||||
[Import OpenStreetMap data](https://github.com/openmaptiles/openmaptiles-tools/blob/master/bin/import-osm) with the mapping rules from
|
||||
`build/mapping.yaml` (which has been created by `make`). Run after any change in layers definition (any change in `mapping.yaml`).
|
||||
|
||||
```bash
|
||||
make import-osm
|
||||
|
@ -145,10 +147,20 @@ make
|
|||
make import-sql
|
||||
```
|
||||
|
||||
Each time you make a modification that adds a new feature to vector tiles e.g. adding new OSM tags, modify the layer
|
||||
style snippet by adding new style layer so the changes are propagated visually into the style.
|
||||
All new style layers must have the `order` value which determines the order or rendering in the map style.
|
||||
After the layer style snippet is modified run:
|
||||
```bash
|
||||
make build-style
|
||||
```
|
||||
|
||||
|
||||
|
||||
Now you are ready to **generate the vector tiles**. By default, `./.env` specifies the entire planet BBOX for zooms 0-7, but running `generate-bbox-file` will analyze the data file and set the `BBOX` param to limit tile generation.
|
||||
|
||||
```
|
||||
make generate-bbox-file # compute data bbox -- not needed for the whole planet
|
||||
make generate-bbox-file # compute data bbox -- not needed for the whole planet or for downloaded area by `make download`
|
||||
make generate-tiles-pg # generate tiles
|
||||
```
|
||||
|
||||
|
@ -162,18 +174,20 @@ make import-data # Import external data from OpenStreetMapData, Natur
|
|||
make download area=albania # download albania .osm.pbf file -- can be skipped if a .osm.pbf file already existing
|
||||
make import-osm # import data into postgres
|
||||
make import-wikidata # import Wikidata
|
||||
make import-sql # create / import sql funtions
|
||||
make generate-bbox-file # compute data bbox -- not needed for the whole planet
|
||||
make import-sql # create / import sql functions
|
||||
make generate-bbox-file # compute data bbox -- not needed for the whole planet or for downloaded area by `make download`
|
||||
make generate-tiles-pg # generate tiles
|
||||
```
|
||||
Instead of calling `make download area=albania` you can add a .osm.pbf file in the `data` folder `openmaptiles/data/your_area_file.osm.pbf`
|
||||
|
||||
To change the name of the output filename, you can modify the variable `MBTILES_FILE` in the `.env` file or set up the environment variable `MBTILES_FILE` before running `./quickstart.sh` or `make generate-tiles-pg` (e.g., `MBTILES_FILENAME=monaco.mbtiles ./quickstart.sh monaco`).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
All code in this repository is under the [BSD license](./LICENSE.md) and the cartography decisions encoded in the schema and SQL are licensed under [CC-BY](./LICENSE.md).
|
||||
All code in this repository is under the [BSD license](./LICENSE.md). Design and the cartography decisions encoded in the schema and SQL are licensed under [CC-BY](./LICENSE.md).
|
||||
|
||||
Products or services using maps derived from OpenMapTiles schema need to visibly credit "OpenMapTiles.org" or reference "OpenMapTiles" with a link to https://openmaptiles.org/. Exceptions to attribution requirement can be granted on request.
|
||||
Products or services using maps derived from OpenMapTiles schema need to **visibly credit "OpenMapTiles.org"** or **reference "OpenMapTiles"** with a link to https://openmaptiles.org/. Exceptions to attribution requirement can be granted on request.
|
||||
|
||||
For a browsable electronic map based on OpenMapTiles and OpenStreetMap data, the
|
||||
credit should appear in the corner of the map. For example:
|
||||
|
|
84
UPDATE.md
|
@ -10,44 +10,71 @@ or import specific change files.
|
|||
|
||||
### Choosing the Download Source
|
||||
|
||||
While GeoFabrik currently provides extracts of basically all countries, they provide only daily updates.
|
||||
While GeoFabrik currently provides extracts of basically all countries, they provide only daily updates.
|
||||
If you need minutely updates you might want to try openstreetmap.fr, for example like this: `make download-osmfr area=africa/eritrea`, which configures minutely updates.
|
||||
|
||||
### Preparations
|
||||
|
||||
If you plan to keep data updated automatically, before importing any data, make sure to set
|
||||
If you plan to keep data updated automatically, before importing any data, make sure to set
|
||||
|
||||
```
|
||||
DIFF_MODE=true
|
||||
```
|
||||
|
||||
|
||||
in the `.env`
|
||||
|
||||
Now download fresh data:
|
||||
|
||||
```
|
||||
```
|
||||
make download area=your-area-of-choice
|
||||
```
|
||||
|
||||
### Keep Database Updated
|
||||
|
||||
You can use the new imposm3 feature to keep the database updated (thanks to the [work by @stirringhalo](https://github.com/openmaptiles/openmaptiles/pull/131)). This will automatically download
|
||||
the OSM change feed and import it into the database.
|
||||
After each run you should also have a list of tiles that have updated.
|
||||
You can use imposm3 to keep the database updated (thanks to the [work by @stirringhalo](https://github.com/openmaptiles/openmaptiles/pull/131)).
|
||||
This will repeatedly download the OSM change feed and import it into the database.
|
||||
In order to be able to update the database, the initial download and import of the OSM data must be done when `DIFF_MODE=true` is set in the `.env` file.
|
||||
In this mode the initial download also sets the update source and the update intervals.
|
||||
|
||||
To start the update process please use
|
||||
```
|
||||
make update-osm
|
||||
make start-update-osm
|
||||
```
|
||||
|
||||
To stop the update process please use
|
||||
```
|
||||
make stop-update-osm
|
||||
```
|
||||
|
||||
After each update activation, **imposm3** will store lists of updated tiles in text format in subfolders of the `diffdir`,
|
||||
named for the date(s) on which the import took place (`YYYYMMDD`).
|
||||
|
||||
See [Generate Changed Tiles](#generate-changed-tiles) below on how this file can be used.
|
||||
|
||||
#### Note
|
||||
When the update process is actively updating the DB it is impossible to successfully generate tiles,
|
||||
as there will be conflicts and deadlocks related to the DB access.
|
||||
|
||||
Unfortunately, there is no known way to execute an external command in-between rounds of the `update-osm` process.
|
||||
|
||||
#### Troubleshooting
|
||||
|
||||
The log file for osm update can be viewed using
|
||||
|
||||
```
|
||||
docker-compose logs --tail 100 --follow update-osm
|
||||
```
|
||||
|
||||
Use `Ctrl-C` to stop following the log.
|
||||
|
||||
The output will be similar to this:
|
||||
|
||||
```
|
||||
[info] Importing #4889572 including changes till ....... +0000 UTC (1m13s behind)
|
||||
```
|
||||
```
|
||||
[info] Importing #4889572 including changes till ....... +0000 UTC (2h10m10s behind)
|
||||
```
|
||||
|
||||
It might take some time to catch up with the latest changes, but the "time behind" should always decrease. If it doesn't, you need to download a new extract our don't have enough system resources to keep-up with the changes.
|
||||
It might take some time to catch up with the latest changes, but the "time behind" should decrease until it is a few minutes.
|
||||
If it doesn't, you need to download a new extract or check that there are enough system resources to keep-up with the changes.
|
||||
|
||||
Finally you will get an output like this - this indicates, that some 6 objects were changed:
|
||||
|
||||
|
@ -55,7 +82,7 @@ Finally you will get an output like this - this indicates, that some 6 objects w
|
|||
[progress] 3s C: 0/s (0) N: 0/s (0) W: 0/s (6) R: 0/s (0)
|
||||
```
|
||||
|
||||
The process will keep running forever and eventually print something like this - which just means that no changes were in the latest changeset:
|
||||
The process will keep running foreverprint something like this - which just means that no changes were in the latest changeset:
|
||||
|
||||
```
|
||||
[progress] 0s C: 0/s (0) N: 0/s (0) W: 0/s (0) R: 0/s (0)
|
||||
|
@ -63,30 +90,27 @@ The process will keep running forever and eventually print something like this -
|
|||
|
||||
### Import Change File
|
||||
|
||||
Given you have a file `changes.osc.gz` in your import folder. Once you ran the import command you should also have a list of tiles that have updated.
|
||||
You may perform a one-time import of OSM changes from the `changes.osc.gz` file in your import folder using
|
||||
|
||||
```
|
||||
make import-diff
|
||||
```
|
||||
|
||||
Similar to[Keep Database Updated](#keep_database_updated) above, **imposm3** will store the list of updated tiles in text file in subfolders of the `diffdir`,
|
||||
named for the date on which the import took place (`YYYYMMDD`).
|
||||
|
||||
See [Generate Changed Tiles](#generate-changed-tiles) below.
|
||||
|
||||
#### Note
|
||||
There is no `make` command for downloading OSM changes into `changes.osc.gz`.
|
||||
You may perform this task using [`osmupdate`](https://wiki.openstreetmap.org/wiki/Osmupdate),
|
||||
[pyosmium-get-changes](https://docs.osmcode.org/pyosmium/latest/tools_get_changes.html),
|
||||
or downloading the changefile directly from the replication server.
|
||||
|
||||
## Generate Changed Tiles
|
||||
|
||||
After the import has finished **imposm3** will store lists of tiles in text format in subfolders of the `diffdir`,
|
||||
named for the date(s) on which the import took place (`YYYYMMDD`).
|
||||
Copy and merge the files to `tiles.txt` in the import folder (`data`), either manually or with the following command, which also removes duplicate tiles so they are only generated once:
|
||||
To generate all changed tiles, based on the lists of all updated tiles, and update the existing MBtiles file, please use
|
||||
|
||||
```
|
||||
cd data && sort ./*/*.tiles | uniq > tiles.txt
|
||||
```
|
||||
|
||||
After generating the tiles.txt you might and to delete the `*.tiles` files to not include them in the next run:
|
||||
|
||||
```
|
||||
cd data && rm ./*/*.tiles
|
||||
```
|
||||
|
||||
Finally run the command to read the tilelist and write the updated vector tiles in the existing MBtiles file.
|
||||
|
||||
```
|
||||
docker-compose run generate-changed-vectortiles
|
||||
make generate-changed-tiles
|
||||
```
|
||||
|
|
|
@ -13,6 +13,7 @@ services:
|
|||
postgres:
|
||||
image: "${POSTGIS_IMAGE:-openmaptiles/postgis}:${TOOLS_VERSION}"
|
||||
# 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:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
networks:
|
||||
|
@ -64,6 +65,7 @@ services:
|
|||
- ./build/sql:/sql
|
||||
- ./build:/mapping
|
||||
- ./cache:/cache
|
||||
- ./style:/style
|
||||
|
||||
update-osm:
|
||||
<<: *openmaptiles-tools
|
||||
|
@ -127,13 +129,15 @@ services:
|
|||
- "8088:8888"
|
||||
|
||||
tileserver-gl:
|
||||
image: "maptiler/tileserver-gl"
|
||||
image: "maptiler/tileserver-gl:latest"
|
||||
command:
|
||||
- --port
|
||||
- "${TPORT:-8080}"
|
||||
- --mbtiles
|
||||
- "${MBTILES_FILE}"
|
||||
- --config
|
||||
- "/style/config.json"
|
||||
ports:
|
||||
- "${TPORT:-8080}:${TPORT:-8080}"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./style:/style
|
||||
- ./build:/build
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
# A script to run the "integrity" continuous integration script.
|
||||
|
||||
area=monaco
|
||||
echo MIN_ZOOM=0 >> .env
|
||||
echo MAX_ZOOM=14 >> .env
|
||||
./quickstart.sh $area
|
||||
export TEST_MODE=yes
|
||||
make generate-devdoc
|
||||
area=europe/monaco
|
||||
echo DIFF_MODE=true >> .env
|
||||
|
||||
# Cleanup
|
||||
rm -fr data build cache
|
||||
# Create data/$area.repl.json
|
||||
make download-geofabrik area=$area
|
||||
# Download 2+ month old data
|
||||
export old_date=$(date --date="$(date +%Y-%m-15) -2 month" +'%y%m01')
|
||||
echo Downloading $old_date extract of $area
|
||||
docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "wget -O data/$area.osm.pbf http://download.geofabrik.de/$area-$old_date.osm.pbf"
|
||||
# Initial import and tile generation
|
||||
./quickstart.sh $area
|
||||
sleep 2
|
||||
echo Downloading updates
|
||||
# Loop to recover from potential "ERROR 429: Too Many Requests"
|
||||
docker-compose run --rm --user=$(id -u):$(id -g) openmaptiles-tools sh -c "
|
||||
while ! osmupdate --keep-tempfiles --base-url=$(sed -n 's/ *\"replication_url\": //p' data/$area.repl.json) data/$area.osm.pbf data/changes.osc.gz ; do
|
||||
sleep 2;
|
||||
echo Sleeping...;
|
||||
sleep 630;
|
||||
done"
|
||||
echo Downloading updates completed
|
||||
echo Importing updates
|
||||
make import-diff
|
||||
echo Generating new tiles
|
||||
make generate-tiles-pg
|
|
@ -5,9 +5,9 @@ layer:
|
|||
buffer_size: 64
|
||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the aerodrome.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the aerodrome. Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
class:
|
||||
description: |
|
||||
Distinguish between more and less important aerodromes.
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "airport-label-major",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "aerodrome_label",
|
||||
"minzoom": 8,
|
||||
"maxzoom": 17,
|
||||
"layout": {
|
||||
"icon-size": 1,
|
||||
"text-font": [
|
||||
"Noto Sans Italic"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
8,
|
||||
10
|
||||
],
|
||||
[
|
||||
14,
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": "aerodrome.12",
|
||||
"text-field": {
|
||||
"stops": [
|
||||
[
|
||||
8,
|
||||
" "
|
||||
],
|
||||
[
|
||||
11,
|
||||
"{name:latin}\n{name:nonlatin}"
|
||||
]
|
||||
]
|
||||
},
|
||||
"visibility": "visible",
|
||||
"text-anchor": "top",
|
||||
"text-offset": [
|
||||
0,
|
||||
0.6
|
||||
],
|
||||
"text-padding": 2,
|
||||
"text-optional": true,
|
||||
"symbol-z-order": "auto",
|
||||
"text-max-width": 9,
|
||||
"icon-allow-overlap": false,
|
||||
"text-allow-overlap": false
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#5e3b9e",
|
||||
"text-halo-blur": 0.5,
|
||||
"text-halo-color": "rgba(255, 255, 255, 0.8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"has",
|
||||
"iata"
|
||||
]
|
||||
],
|
||||
"order": 190
|
||||
}
|
||||
]
|
||||
}
|
|
@ -12,7 +12,7 @@ CREATE SCHEMA IF NOT EXISTS aerodrome_label;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS aerodrome_label.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: osm_aerodrome_label_point -> osm_aerodrome_label_point
|
||||
|
@ -48,11 +48,7 @@ SELECT update_aerodrome_label_point(true);
|
|||
CREATE OR REPLACE FUNCTION aerodrome_label.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO aerodrome_label.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO aerodrome_label.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO aerodrome_label.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -77,6 +73,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh aerodrome_label';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE aerodrome_label.osm_ids;
|
||||
ANALYZE osm_aerodrome_label_point;
|
||||
|
||||
PERFORM update_aerodrome_label_point(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM aerodrome_label.osm_ids;
|
||||
|
@ -89,13 +90,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_aerodrome_label_point
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE aerodrome_label.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_aerodrome_label_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE aerodrome_label.flag();
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "aeroway_fill",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "aeroway",
|
||||
"minzoom": 11,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": {
|
||||
"stops": [
|
||||
[
|
||||
6,
|
||||
"rgba(223, 223, 228, 1)"
|
||||
],
|
||||
[
|
||||
12,
|
||||
"rgba(232, 231, 223, 1)"
|
||||
]
|
||||
]
|
||||
},
|
||||
"fill-opacity": 1
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"==",
|
||||
"$type",
|
||||
"Polygon"
|
||||
],
|
||||
"order": 3
|
||||
},
|
||||
{
|
||||
"id": "aeroway_runway",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "aeroway",
|
||||
"minzoom": 11,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "rgba(178, 181, 209, 1)",
|
||||
"line-width": {
|
||||
"base": 1.2,
|
||||
"stops": [
|
||||
[
|
||||
11,
|
||||
3
|
||||
],
|
||||
[
|
||||
20,
|
||||
48
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-opacity": 1
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"$type",
|
||||
"LineString"
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"runway"
|
||||
]
|
||||
],
|
||||
"order": 22
|
||||
},
|
||||
{
|
||||
"id": "aeroway_taxiway",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "aeroway",
|
||||
"minzoom": 11,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "rgba(178, 181, 209, 1)",
|
||||
"line-width": {
|
||||
"base": 1.2,
|
||||
"stops": [
|
||||
[
|
||||
11,
|
||||
1
|
||||
],
|
||||
[
|
||||
20,
|
||||
24
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-opacity": 1
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"$type",
|
||||
"LineString"
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"taxiway"
|
||||
]
|
||||
],
|
||||
"order": 23
|
||||
},
|
||||
{
|
||||
"id": "airport_label",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "aeroway",
|
||||
"minzoom": 14,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Italic",
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
15,
|
||||
9
|
||||
],
|
||||
[
|
||||
19,
|
||||
15
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{ref}",
|
||||
"visibility": "visible",
|
||||
"symbol-placement": "line"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#333333",
|
||||
"text-halo-color": "rgba(255, 255, 255, 0.8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"runway",
|
||||
"taxiway"
|
||||
]
|
||||
],
|
||||
"order": 191
|
||||
},
|
||||
{
|
||||
"id": "airport_gate",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "aeroway",
|
||||
"minzoom": 16.5,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
17,
|
||||
9
|
||||
],
|
||||
[
|
||||
19,
|
||||
15
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{ref}",
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "rgba(135, 135, 135, 1)",
|
||||
"text-halo-color": "rgba(255, 255, 255, 1)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"gate"
|
||||
]
|
||||
],
|
||||
"order": 192
|
||||
}
|
||||
]
|
||||
}
|
|
@ -150,38 +150,10 @@ CREATE MATERIALIZED VIEW osm_border_linestring_gen_z4 AS
|
|||
(
|
||||
SELECT ST_Simplify(geometry, ZRes(5)) AS geometry, adm0_l, adm0_r, admin_level, disputed, name, claimed_by, maritime
|
||||
FROM osm_border_linestring_gen_z5
|
||||
WHERE admin_level = 2 AND (maritime OR disputed)
|
||||
WHERE admin_level = 2 AND maritime
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen_z4_idx ON osm_border_linestring_gen_z4 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_border_linestring_gen_z4 -> osm_border_disp_linestring_gen_z3
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_disp_linestring_gen_z3 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_disp_linestring_gen_z3 AS
|
||||
(
|
||||
SELECT ST_Simplify(geometry, ZRes(4)) AS geometry, adm0_l, adm0_r, admin_level, TRUE AS disputed, name, claimed_by, maritime
|
||||
FROM osm_border_linestring_gen_z4
|
||||
WHERE disputed -- AND admin_level = 2
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_disp_linestring_gen_z3_idx ON osm_border_disp_linestring_gen_z3 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_border_disp_linestring_gen_z3 -> osm_border_disp_linestring_gen_z2
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_disp_linestring_gen_z2 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_disp_linestring_gen_z2 AS
|
||||
(
|
||||
SELECT ST_Simplify(geometry, ZRes(3)) AS geometry, adm0_l, adm0_r, admin_level, TRUE AS disputed, name, claimed_by, maritime
|
||||
FROM osm_border_disp_linestring_gen_z3
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_disp_linestring_gen_z2_idx ON osm_border_disp_linestring_gen_z2 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_border_disp_linestring_gen_z2 -> osm_border_disp_linestring_gen_z1
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_disp_linestring_gen_z1 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_disp_linestring_gen_z1 AS
|
||||
(
|
||||
SELECT ST_Simplify(geometry, ZRes(2)) AS geometry, adm0_l, adm0_r, admin_level, TRUE AS disputed, name, claimed_by, maritime
|
||||
FROM osm_border_disp_linestring_gen_z2
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_disp_linestring_gen_z2_idx ON osm_border_disp_linestring_gen_z2 USING gist (geometry);
|
||||
|
||||
-- ne_10m_admin_0_boundary_lines_land
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land -> ne_10m_admin_0_boundary_lines_land_gen_z4
|
||||
DROP MATERIALIZED VIEW IF EXISTS ne_10m_admin_0_boundary_lines_land_gen_z4 CASCADE;
|
||||
|
@ -190,7 +162,7 @@ CREATE MATERIALIZED VIEW ne_10m_admin_0_boundary_lines_land_gen_z4 AS
|
|||
SELECT ST_Simplify(geometry, ZRes(6)) as geometry,
|
||||
2 AS admin_level,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN 'ne10m_' || ogc_fid ELSE NULL::text END) AS disputed_name,
|
||||
NULL::text AS disputed_name,
|
||||
NULL::text AS claimed_by,
|
||||
FALSE AS maritime
|
||||
FROM ne_10m_admin_0_boundary_lines_land
|
||||
|
@ -198,6 +170,21 @@ WHERE featurecla <> 'Lease limit'
|
|||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_land_gen_z4_idx ON ne_10m_admin_0_boundary_lines_land_gen_z4 USING gist (geometry);
|
||||
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land -> ne_10m_admin_0_boundary_lines_land_disputed
|
||||
DROP MATERIALIZED VIEW IF EXISTS ne_10m_admin_0_boundary_lines_land_disputed CASCADE;
|
||||
CREATE MATERIALIZED VIEW ne_10m_admin_0_boundary_lines_land_disputed AS
|
||||
(
|
||||
SELECT geometry,
|
||||
2 AS admin_level,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
|
||||
NULL::text AS disputed_name,
|
||||
NULL::text AS claimed_by,
|
||||
FALSE AS maritime
|
||||
FROM ne_10m_admin_0_boundary_lines_land
|
||||
WHERE featurecla LIKE 'Disputed%' AND adm0_left = 'South Sudan' AND adm0_right = 'Kenya'
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_land_disputed_idx ON ne_10m_admin_0_boundary_lines_land_disputed USING gist (geometry);
|
||||
|
||||
-- ne_10m_admin_1_states_provinces_lines
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines -> ne_10m_admin_1_states_provinces_lines_gen_z4
|
||||
DROP MATERIALIZED VIEW IF EXISTS ne_10m_admin_1_states_provinces_lines_gen_z4 CASCADE;
|
||||
|
@ -267,7 +254,7 @@ CREATE MATERIALIZED VIEW ne_50m_admin_0_boundary_lines_land_gen_z3 AS
|
|||
SELECT ST_Simplify(geometry, ZRes(5)) as geometry,
|
||||
2 AS admin_level,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN 'ne50m_' || ogc_fid ELSE NULL::text END) AS disputed_name,
|
||||
NULL::text AS disputed_name,
|
||||
NULL::text AS claimed_by,
|
||||
FALSE AS maritime
|
||||
FROM ne_50m_admin_0_boundary_lines_land
|
||||
|
@ -310,7 +297,7 @@ CREATE MATERIALIZED VIEW ne_110m_admin_0_boundary_lines_land_gen_z0 AS
|
|||
SELECT ST_Simplify(geometry, ZRes(2)) as geometry,
|
||||
2 AS admin_level,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN TRUE ELSE FALSE END) AS disputed,
|
||||
(CASE WHEN featurecla LIKE 'Disputed%' THEN 'ne110m_' || ogc_fid ELSE NULL::text END) AS disputed_name,
|
||||
NULL::text AS disputed_name,
|
||||
NULL::text AS claimed_by,
|
||||
FALSE AS maritime
|
||||
FROM ne_110m_admin_0_boundary_lines_land
|
||||
|
@ -347,8 +334,10 @@ FROM ne_110m_admin_0_boundary_lines_land_gen_z0
|
|||
|
||||
-- etldoc: ne_50m_admin_0_boundary_lines_land_gen_z1 -> boundary_z1
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z1 -> boundary_z1
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land_disputed -> boundary_z1
|
||||
-- etldoc: osm_border_disp_linestring_gen_z1 -> boundary_z1
|
||||
CREATE OR REPLACE VIEW boundary_z1 AS
|
||||
DROP MATERIALIZED VIEW IF EXISTS boundary_z1 CASCADE;
|
||||
CREATE MATERIALIZED VIEW boundary_z1 AS
|
||||
(
|
||||
SELECT geometry,
|
||||
admin_level,
|
||||
|
@ -374,18 +363,21 @@ SELECT geometry,
|
|||
admin_level,
|
||||
NULL::text AS adm0_l,
|
||||
NULL::text AS adm0_r,
|
||||
TRUE AS disputed,
|
||||
edit_name(name) AS disputed_name,
|
||||
disputed,
|
||||
disputed_name,
|
||||
claimed_by,
|
||||
maritime
|
||||
FROM osm_border_disp_linestring_gen_z1
|
||||
FROM ne_10m_admin_0_boundary_lines_land_disputed
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS boundary_z1_idx ON boundary_z1 USING gist (geometry);
|
||||
|
||||
|
||||
-- etldoc: ne_50m_admin_0_boundary_lines_land_gen_z2 -> boundary_z2
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z2 -> boundary_z2
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land_disputed -> boundary_z2
|
||||
-- etldoc: osm_border_disp_linestring_gen_z2 -> boundary_z2
|
||||
CREATE OR REPLACE VIEW boundary_z2 AS
|
||||
DROP MATERIALIZED VIEW IF EXISTS boundary_z2 CASCADE;
|
||||
CREATE MATERIALIZED VIEW boundary_z2 AS
|
||||
(
|
||||
SELECT geometry,
|
||||
admin_level,
|
||||
|
@ -411,17 +403,20 @@ SELECT geometry,
|
|||
admin_level,
|
||||
NULL::text AS adm0_l,
|
||||
NULL::text AS adm0_r,
|
||||
TRUE AS disputed,
|
||||
edit_name(name) AS disputed_name,
|
||||
disputed,
|
||||
disputed_name,
|
||||
claimed_by,
|
||||
maritime
|
||||
FROM osm_border_disp_linestring_gen_z2
|
||||
FROM ne_10m_admin_0_boundary_lines_land_disputed
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS boundary_z2_idx ON boundary_z2 USING gist (geometry);
|
||||
|
||||
-- etldoc: ne_50m_admin_0_boundary_lines_land_gen_z3 -> boundary_z3
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z3 -> boundary_z3
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land_disputed -> boundary_z3
|
||||
-- etldoc: osm_border_disp_linestring_gen_z3 -> boundary_z3
|
||||
CREATE OR REPLACE VIEW boundary_z3 AS
|
||||
DROP MATERIALIZED VIEW IF EXISTS boundary_z3 CASCADE;
|
||||
CREATE MATERIALIZED VIEW boundary_z3 AS
|
||||
(
|
||||
SELECT geometry,
|
||||
admin_level,
|
||||
|
@ -447,17 +442,19 @@ SELECT geometry,
|
|||
admin_level,
|
||||
NULL::text AS adm0_l,
|
||||
NULL::text AS adm0_r,
|
||||
TRUE AS disputed,
|
||||
edit_name(name) AS disputed_name,
|
||||
disputed,
|
||||
disputed_name,
|
||||
claimed_by,
|
||||
maritime
|
||||
FROM osm_border_disp_linestring_gen_z3
|
||||
FROM ne_10m_admin_0_boundary_lines_land_disputed
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS boundary_z3_idx ON boundary_z3 USING gist (geometry);
|
||||
|
||||
-- etldoc: ne_10m_admin_0_boundary_lines_land_gen_z4 -> boundary_z4
|
||||
-- etldoc: ne_10m_admin_1_states_provinces_lines_gen_z4 -> boundary_z4
|
||||
-- etldoc: osm_border_linestring_gen_z4 -> boundary_z4
|
||||
CREATE OR REPLACE VIEW boundary_z4 AS
|
||||
DROP MATERIALIZED VIEW IF EXISTS boundary_z4 CASCADE;
|
||||
CREATE MATERIALIZED VIEW boundary_z4 AS
|
||||
(
|
||||
SELECT geometry,
|
||||
admin_level,
|
||||
|
@ -489,6 +486,7 @@ SELECT geometry,
|
|||
maritime
|
||||
FROM osm_border_linestring_gen_z4
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS boundary_z4_idx ON boundary_z4 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_border_linestring_gen_z5 -> boundary_z5
|
||||
CREATE OR REPLACE VIEW boundary_z5 AS
|
||||
|
@ -624,7 +622,7 @@ FROM osm_border_linestring_gen_z13
|
|||
);
|
||||
|
||||
-- etldoc: layer_boundary[shape=record fillcolor=lightpink, style="rounded,filled",
|
||||
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1> z1 |<z2> z2 | <z3> z3 | <z4> z4 | <z5> z5 | <z6> z6 | <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13+"]
|
||||
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1> z1 |<z2> z2 | <z3> z3 | <z4> z4 | <z5> z5 | <z6> z6 | <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14> z14+"]
|
||||
CREATE OR REPLACE FUNCTION layer_boundary(bbox geometry, zoom_level int)
|
||||
RETURNS TABLE
|
||||
(
|
||||
|
@ -635,11 +633,14 @@ CREATE OR REPLACE FUNCTION layer_boundary(bbox geometry, zoom_level int)
|
|||
disputed int,
|
||||
disputed_name text,
|
||||
claimed_by text,
|
||||
maritime int
|
||||
maritime int,
|
||||
class text,
|
||||
name text,
|
||||
tags hstore
|
||||
)
|
||||
AS
|
||||
$$
|
||||
SELECT geometry, admin_level, adm0_l, adm0_r, disputed::int, disputed_name, claimed_by, maritime::int
|
||||
SELECT geometry, admin_level, adm0_l, adm0_r, disputed::int, disputed_name, claimed_by, maritime::int, NULL::text, NULL::text, NULL::hstore
|
||||
FROM (
|
||||
-- etldoc: boundary_z0 -> layer_boundary:z0
|
||||
SELECT *
|
||||
|
@ -724,7 +725,134 @@ FROM (
|
|||
FROM boundary_z13
|
||||
WHERE geometry && bbox
|
||||
AND zoom_level >= 13
|
||||
) AS zoom_levels;
|
||||
) AS segment_zoom_levels
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT geometry, NULL::int, NULL::text, NULL::text, NULL::int, NULL::text, NULL::text, NULL::int, class, name, tags
|
||||
FROM (
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z4 -> layer_boundary:z4
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z4
|
||||
WHERE zoom_level = 4
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z5 -> layer_boundary:z5
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z5
|
||||
WHERE zoom_level = 5
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z6 -> layer_boundary:z6
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z6
|
||||
WHERE zoom_level = 6
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z7 -> layer_boundary:z7
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z7
|
||||
WHERE zoom_level = 7
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z8 -> layer_boundary:z8
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z8
|
||||
WHERE zoom_level = 8
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z9 -> layer_boundary:z9
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z9
|
||||
WHERE zoom_level = 9
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z10 -> layer_boundary:z10
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z10
|
||||
WHERE zoom_level = 10
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z11 -> layer_boundary:z11
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z11
|
||||
WHERE zoom_level = 11
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z12 -> layer_boundary:z12
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z12
|
||||
WHERE zoom_level = 12
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon_gen_z13 -> layer_boundary:z13
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon_gen_z13
|
||||
WHERE zoom_level = 13
|
||||
AND geometry && bbox
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_boundary_polygon -> layer_boundary:z14
|
||||
SELECT geometry,
|
||||
boundary AS class,
|
||||
name,
|
||||
tags
|
||||
FROM osm_boundary_polygon
|
||||
WHERE zoom_level = 14
|
||||
AND geometry && bbox
|
||||
|
||||
) AS area_zoom_levels
|
||||
|
||||
$$ LANGUAGE SQL STABLE
|
||||
-- STRICT
|
||||
PARALLEL SAFE;
|
||||
|
|
|
@ -9,13 +9,17 @@ layer:
|
|||
- ne_50m_admin_0_boundary_lines_land
|
||||
- ne_110m_admin_0_boundary_lines_land
|
||||
description: |
|
||||
Contains administrative boundaries as linestrings.
|
||||
Contains administrative boundaries as linestrings and aboriginal lands as polygons.
|
||||
Until z4 [Natural Earth data](http://www.naturalearthdata.com/downloads/) is used after which
|
||||
OSM boundaries ([`boundary=administrative`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative))
|
||||
are present from z5 to z14 (also for maritime boundaries with `admin_level <= 2` at z4).
|
||||
OSM data contains several [`admin_level`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level)
|
||||
but for most styles it makes sense to just style `admin_level=2` and `admin_level=4`.
|
||||
fields:
|
||||
class:
|
||||
description: |
|
||||
Use the **class** to differentiate between different kinds of boundaries. The class for `boundary=aboriginal_lands` is `aboriginal_lands`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value (area features only).
|
||||
admin_level: |
|
||||
OSM [admin_level](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level)
|
||||
indicating the level of importance of this boundary.
|
||||
|
@ -58,8 +62,9 @@ layer:
|
|||
buffer_size: 4
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
query: (SELECT geometry, admin_level, adm0_l, adm0_r, disputed, disputed_name, claimed_by, maritime FROM layer_boundary(!bbox!, z(!scale_denominator!))) AS t
|
||||
query: (SELECT geometry, admin_level, adm0_l, adm0_r, disputed, disputed_name, claimed_by, maritime, class, name, {name_languages} FROM layer_boundary(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./update_boundary_polygon.sql
|
||||
- ./boundary_name.sql
|
||||
- ./boundary.sql
|
||||
datasources:
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 552 KiB Po Szerokość: | Wysokość: | Rozmiar: 750 KiB |
|
@ -4,6 +4,67 @@ generalized_tables:
|
|||
source: border_linestring
|
||||
sql_filter: ST_GeometryType(geometry) = 'ST_LineString' AND (disputed OR dispute OR border_status = 'disputed' OR disputed_by <> '') AND admin_level = 2
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z5 -> osm_boundary_polygon_gen_z4
|
||||
boundary_polygon_gen_z4:
|
||||
source: boundary_polygon_gen_z5
|
||||
sql_filter: area>power(ZRES3,2)
|
||||
tolerance: ZRES4
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z6 -> osm_boundary_polygon_gen_z5
|
||||
boundary_polygon_gen_z5:
|
||||
source: boundary_polygon_gen_z6
|
||||
sql_filter: area>power(ZRES4,2)
|
||||
tolerance: ZRES5
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z7 -> osm_boundary_polygon_gen_z6
|
||||
boundary_polygon_gen_z6:
|
||||
source: boundary_polygon_gen_z7
|
||||
sql_filter: area>power(ZRES5,2)
|
||||
tolerance: ZRES6
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z8 -> osm_boundary_polygon_gen_z7
|
||||
boundary_polygon_gen_z7:
|
||||
source: boundary_polygon_gen_z8
|
||||
sql_filter: area>power(ZRES6,2)
|
||||
tolerance: ZRES7
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z9 -> osm_boundary_polygon_gen_z8
|
||||
boundary_polygon_gen_z8:
|
||||
source: boundary_polygon_gen_z9
|
||||
sql_filter: area>power(ZRES7,2)
|
||||
tolerance: ZRES8
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z10 -> osm_boundary_polygon_gen_z9
|
||||
boundary_polygon_gen_z9:
|
||||
source: boundary_polygon_gen_z10
|
||||
sql_filter: area>power(ZRES8,2)
|
||||
tolerance: ZRES9
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z11 -> osm_boundary_polygon_gen_z10
|
||||
boundary_polygon_gen_z10:
|
||||
source: boundary_polygon_gen_z11
|
||||
sql_filter: area>power(ZRES9,2)
|
||||
tolerance: ZRES10
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z12 -> osm_boundary_polygon_gen_z11
|
||||
boundary_polygon_gen_z11:
|
||||
source: boundary_polygon_gen_z12
|
||||
sql_filter: area>power(ZRES10,2)
|
||||
tolerance: ZRES11
|
||||
|
||||
# etldoc: osm_boundary_polygon_gen_z13 -> osm_boundary_polygon_gen_z12
|
||||
boundary_polygon_gen_z12:
|
||||
source: boundary_polygon_gen_z13
|
||||
sql_filter: area>power(ZRES11,2)
|
||||
tolerance: ZRES12
|
||||
|
||||
# etldoc: osm_boundary_polygon -> osm_boundary_polygon_gen_z13
|
||||
boundary_polygon_gen_z13:
|
||||
source: boundary_polygon
|
||||
sql_filter: area>power(ZRES12,2) AND ST_IsValid(geometry)
|
||||
tolerance: ZRES13
|
||||
|
||||
|
||||
tables:
|
||||
# etldoc: imposm3 -> osm_border_linestring
|
||||
border_linestring:
|
||||
|
@ -71,3 +132,29 @@ tables:
|
|||
- dispute
|
||||
boundary_type:
|
||||
- maritime
|
||||
|
||||
# etldoc: imposm3 -> osm_boundary_polygon
|
||||
boundary_polygon:
|
||||
type: polygon
|
||||
filters:
|
||||
require:
|
||||
type: [boundary]
|
||||
boundary: [aboriginal_lands]
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
type: validated_geometry
|
||||
- name: name
|
||||
key: name
|
||||
type: string
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- name: boundary
|
||||
key: boundary
|
||||
type: string
|
||||
- name: area
|
||||
type: area
|
||||
mapping:
|
||||
boundary:
|
||||
- aboriginal_lands
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 14 KiB Po Szerokość: | Wysokość: | Rozmiar: 22 KiB |
|
@ -0,0 +1,287 @@
|
|||
{
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
ALTER TABLE osm_boundary_polygon
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z13
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z12
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z11
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z10
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z9
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z8
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z7
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z6
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
ALTER TABLE osm_boundary_polygon_gen_z5
|
||||
ADD COLUMN IF NOT EXISTS geometry_point geometry;
|
||||
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z13;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z12;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z11;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z10;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z9;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z8;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z7;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z6;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_boundary_polygon_gen_z5;
|
||||
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
|
||||
-- etldoc: osm_boundary_polygon_gen_z12 -> osm_boundary_polygon_gen_z12
|
||||
-- etldoc: osm_boundary_polygon_gen_z11 -> osm_boundary_polygon_gen_z11
|
||||
-- etldoc: osm_boundary_polygon_gen_z10 -> osm_boundary_polygon_gen_z10
|
||||
-- etldoc: osm_boundary_polygon_gen_z9 -> osm_boundary_polygon_gen_z9
|
||||
-- etldoc: osm_boundary_polygon_gen_z8 -> osm_boundary_polygon_gen_z8
|
||||
-- etldoc: osm_boundary_polygon_gen_z7 -> osm_boundary_polygon_gen_z7
|
||||
-- etldoc: osm_boundary_polygon_gen_z6 -> osm_boundary_polygon_gen_z6
|
||||
-- etldoc: osm_boundary_polygon_gen_z5 -> osm_boundary_polygon_gen_z5
|
||||
CREATE OR REPLACE FUNCTION update_osm_boundary_polygon() RETURNS void AS
|
||||
$$
|
||||
BEGIN
|
||||
UPDATE osm_boundary_polygon
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z13
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z12
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z11
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z10
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z9
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z8
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z7
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z6
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_boundary_polygon_gen_z5
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
SELECT update_osm_boundary_polygon();
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_point_geom_idx ON osm_boundary_polygon USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z13_point_geom_idx ON osm_boundary_polygon_gen_z13 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z12_point_geom_idx ON osm_boundary_polygon_gen_z12 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z11_point_geom_idx ON osm_boundary_polygon_gen_z11 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z10_point_geom_idx ON osm_boundary_polygon_gen_z10 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z9_point_geom_idx ON osm_boundary_polygon_gen_z9 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z8_point_geom_idx ON osm_boundary_polygon_gen_z8 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z7_point_geom_idx ON osm_boundary_polygon_gen_z7 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z6_point_geom_idx ON osm_boundary_polygon_gen_z6 USING gist (geometry_point);
|
||||
CREATE INDEX IF NOT EXISTS osm_boundary_polygon_gen_z5_point_geom_idx ON osm_boundary_polygon_gen_z5 USING gist (geometry_point);
|
||||
|
||||
CREATE 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
|
||||
$$
|
||||
BEGIN
|
||||
NEW.tags = update_tags(NEW.tags, NEW.geometry);
|
||||
NEW.geometry_point = ST_PointOnSurface(NEW.geometry);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z13
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z12
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z11
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z10
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z9
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z8
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z7
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z6
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
CREATE TRIGGER update_row
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON osm_boundary_polygon_gen_z5
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_boundary_polygon_row();
|
||||
|
||||
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();
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "building",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "building",
|
||||
"minzoom": 12,
|
||||
"maxzoom": 24,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": {
|
||||
"stops": [
|
||||
[
|
||||
13,
|
||||
"rgba(222, 213, 207, 1)"
|
||||
],
|
||||
[
|
||||
16,
|
||||
"#d9d0c9"
|
||||
]
|
||||
]
|
||||
},
|
||||
"fill-outline-color": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
13,
|
||||
"#9A918A"
|
||||
],
|
||||
[
|
||||
16,
|
||||
"rgba(166, 157, 150, 1)"
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"order": 19
|
||||
}
|
||||
]
|
||||
}
|
|
@ -14,10 +14,20 @@ SELECT
|
|||
-- etldoc: osm_housenumber_point -> layer_housenumber:z14_
|
||||
osm_id,
|
||||
geometry,
|
||||
housenumber
|
||||
FROM osm_housenumber_point
|
||||
WHERE zoom_level >= 14
|
||||
AND geometry && bbox;
|
||||
display_housenumber(housenumber)
|
||||
FROM (
|
||||
SELECT
|
||||
osm_id,
|
||||
geometry,
|
||||
housenumber,
|
||||
row_number() OVER(PARTITION BY concat(street, block_number, housenumber) ORDER BY has_name ASC) as rn
|
||||
FROM osm_housenumber_point
|
||||
WHERE 1=1
|
||||
AND zoom_level >= 14
|
||||
AND geometry && bbox
|
||||
) t
|
||||
WHERE rn = 1;
|
||||
|
||||
$$ LANGUAGE SQL STABLE
|
||||
-- STRICT
|
||||
PARALLEL SAFE;
|
||||
|
|
|
@ -3,15 +3,18 @@ layer:
|
|||
description: |
|
||||
Everything in OpenStreetMap which contains a `addr:housenumber` tag useful for labelling housenumbers on a map.
|
||||
This adds significant size to *z14*. For buildings the centroid of the building is used as housenumber.
|
||||
Duplicates within a tile are dropped if they have the same street/block_number (records without name tag are prioritized for preservation).
|
||||
buffer_size: 8
|
||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
housenumber: Value of the [`addr:housenumber`](http://wiki.openstreetmap.org/wiki/Key:addr) tag.
|
||||
housenumber: Value of the [`addr:housenumber`](http://wiki.openstreetmap.org/wiki/Key:addr) tag.
|
||||
If there are multiple values separated by semi-colons, the first and last value separated by a dash.
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
srid: 900913
|
||||
query: (SELECT geometry, housenumber FROM layer_housenumber(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./housenumber_display.sql
|
||||
- ./housenumber_centroid.sql
|
||||
- ./housenumber.sql
|
||||
datasources:
|
||||
|
|
|
@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS housenumber;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS housenumber.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: osm_housenumber_point -> osm_housenumber_point
|
||||
|
@ -22,6 +22,16 @@ $$
|
|||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM housenumber.osm_ids))
|
||||
AND ST_GeometryType(geometry) <> 'ST_Point'
|
||||
AND ST_IsValid(geometry);
|
||||
|
||||
-- we don't need exact name just to know if it's present
|
||||
UPDATE osm_housenumber_point
|
||||
SET has_name =
|
||||
CASE
|
||||
WHEN has_name = '' THEN '0'
|
||||
ELSE '1'
|
||||
END
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM housenumber.osm_ids));
|
||||
|
||||
$$ LANGUAGE SQL;
|
||||
|
||||
SELECT convert_housenumber_point(true);
|
||||
|
@ -31,11 +41,7 @@ SELECT convert_housenumber_point(true);
|
|||
CREATE OR REPLACE FUNCTION housenumber.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO housenumber.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO housenumber.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO housenumber.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -60,6 +66,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh housenumber';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE housenumber.osm_ids;
|
||||
ANALYZE osm_housenumber_point;
|
||||
|
||||
PERFORM convert_housenumber_point(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM housenumber.osm_ids;
|
||||
|
@ -72,13 +83,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_housenumber_point
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE housenumber.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_housenumber_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE housenumber.flag();
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
CREATE OR REPLACE FUNCTION display_housenumber_nonnumeric(raw_housenumber text)
|
||||
RETURNS text AS $$
|
||||
-- Find the position of the semicolon in the input string
|
||||
-- and extract the first and last value
|
||||
SELECT substring(raw_housenumber from 1 for position(';' in raw_housenumber) - 1)
|
||||
|| '–'
|
||||
|| substring(raw_housenumber from position(';' in raw_housenumber) + 1);
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION display_housenumber(raw_housenumber text)
|
||||
RETURNS text AS $$
|
||||
SELECT CASE
|
||||
WHEN raw_housenumber !~ ';' THEN raw_housenumber
|
||||
WHEN raw_housenumber ~ '[^0-9;]' THEN display_housenumber_nonnumeric(raw_housenumber)
|
||||
ELSE
|
||||
(SELECT min(value)::text || '–' || max(value)::text
|
||||
FROM unnest(array_remove(string_to_array(raw_housenumber, ';'), '')::bigint[]) AS value)
|
||||
END
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
|
@ -12,6 +12,15 @@ tables:
|
|||
- name: housenumber
|
||||
key: addr:housenumber
|
||||
type: string
|
||||
- name: street
|
||||
key: addr:street
|
||||
type: string
|
||||
- name: block_number
|
||||
key: addr:block_number
|
||||
type: string
|
||||
- name: has_name
|
||||
key: name
|
||||
type: string
|
||||
type_mappings:
|
||||
points:
|
||||
addr:housenumber:
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "housenumber",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "housenumber",
|
||||
"minzoom": 17,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
17,
|
||||
9
|
||||
],
|
||||
[
|
||||
22,
|
||||
11
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{housenumber}",
|
||||
"text-padding": 3,
|
||||
"text-line-height": -0.15,
|
||||
"symbol-avoid-edges": false,
|
||||
"text-allow-overlap": false,
|
||||
"text-ignore-placement": false
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "rgba(102, 102, 102, 1)",
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"order": 154
|
||||
}
|
||||
]
|
||||
}
|
|
@ -22,7 +22,7 @@ CREATE TABLE simplify_vw_z13 AS
|
|||
ST_SimplifyVW(geometry, power(zres(13),2)),
|
||||
0.001)) AS geometry
|
||||
FROM osm_landcover_polygon
|
||||
WHERE ST_Area(geometry) > power(zres(10),2)
|
||||
WHERE ST_Area(geometry) > power(zres(12),2)
|
||||
);
|
||||
CREATE INDEX ON simplify_vw_z13 USING GIST (geometry);
|
||||
|
||||
|
@ -58,7 +58,7 @@ CREATE TABLE simplify_vw_z12 AS
|
|||
ST_SimplifyVW(geometry, power(zres(12),2)),
|
||||
0.001)) AS geometry
|
||||
FROM simplify_vw_z13
|
||||
WHERE ST_Area(geometry) > power(zres(9),2)
|
||||
WHERE ST_Area(geometry) > power(zres(11),2)
|
||||
);
|
||||
CREATE INDEX ON simplify_vw_z12 USING GIST (geometry);
|
||||
|
||||
|
@ -94,7 +94,7 @@ CREATE TABLE simplify_vw_z11 AS
|
|||
ST_SimplifyVW(geometry, power(zres(11),2)),
|
||||
0.001)) AS geometry
|
||||
FROM simplify_vw_z12
|
||||
WHERE ST_Area(geometry) > power(zres(8),2)
|
||||
WHERE ST_Area(geometry) > power(zres(10),2)
|
||||
);
|
||||
CREATE INDEX ON simplify_vw_z11 USING GIST (geometry);
|
||||
|
||||
|
@ -130,7 +130,7 @@ CREATE TABLE simplify_vw_z10 AS
|
|||
ST_SimplifyVW(geometry, power(zres(10),2)),
|
||||
0.001)) AS geometry
|
||||
FROM simplify_vw_z11
|
||||
WHERE ST_Area(geometry) > power(zres(8),2)
|
||||
WHERE ST_Area(geometry) > power(zres(9),2)
|
||||
);
|
||||
CREATE INDEX ON simplify_vw_z10 USING GIST (geometry);
|
||||
|
||||
|
@ -166,7 +166,7 @@ CREATE TABLE simplify_vw_z9 AS
|
|||
ST_SimplifyVW(geometry, power(zres(9),2)),
|
||||
0.001)) AS geometry
|
||||
FROM simplify_vw_z10
|
||||
WHERE ST_Area(geometry) > power(zres(7),2)
|
||||
WHERE ST_Area(geometry) > power(zres(8),2)
|
||||
);
|
||||
CREATE INDEX ON simplify_vw_z9 USING GIST (geometry);
|
||||
|
||||
|
@ -214,7 +214,7 @@ CREATE TABLE simplify_vw_z8 AS
|
|||
ST_SimplifyVW(geometry, power(zres(8),2)),
|
||||
0.001)) AS geometry
|
||||
FROM simplify_vw_z9
|
||||
WHERE ST_Area(geometry) > power(zres(6),2)
|
||||
WHERE ST_Area(geometry) > power(zres(7),2)
|
||||
);
|
||||
CREATE INDEX ON simplify_vw_z8 USING GIST (geometry);
|
||||
|
||||
|
@ -231,6 +231,7 @@ SELECT subclass,
|
|||
ST_ClusterDBSCAN(geometry, eps := 0, minpoints := 1) OVER () AS cid,
|
||||
geometry
|
||||
FROM simplify_vw_z8
|
||||
WHERE subclass IN ('wood', 'forest')
|
||||
) union_geom
|
||||
GROUP BY subclass,
|
||||
cid
|
||||
|
@ -253,7 +254,7 @@ CREATE TABLE simplify_vw_z7 AS
|
|||
ST_SimplifyVW(geometry, power(zres(7),2)),
|
||||
0.001)) AS geometry
|
||||
FROM simplify_vw_z8
|
||||
WHERE ST_Area(geometry) > power(zres(5),2)
|
||||
WHERE ST_Area(geometry) > power(zres(6),2)
|
||||
);
|
||||
CREATE INDEX ON simplify_vw_z7 USING GIST (geometry);
|
||||
|
||||
|
|
|
@ -2,7 +2,11 @@ layer:
|
|||
id: "landcover"
|
||||
requires:
|
||||
tables:
|
||||
- ne_10m_antarctic_ice_shelves_polys
|
||||
- ne_10m_glaciated_areas
|
||||
- ne_50m_antarctic_ice_shelves_polys
|
||||
- ne_50m_glaciated_areas
|
||||
- ne_110m_glaciated_areas
|
||||
description: |
|
||||
Landcover is used to describe the physical material at the surface of the earth. At lower zoom levels this is
|
||||
from Natural Earth data for glaciers and ice shelves and at higher zoom levels the landcover is [implied by OSM tags](http://wiki.openstreetmap.org/wiki/Landcover). The most common use case for this layer
|
||||
|
@ -22,7 +26,7 @@ layer:
|
|||
rock:
|
||||
subclass: ['bare_rock', 'scree']
|
||||
grass:
|
||||
subclass: ['fell', 'grassland', 'heath', 'scrub', 'tundra', 'grass', 'meadow', 'allotments', 'park', 'village_green', 'recreation_ground', 'garden', 'golf_course']
|
||||
subclass: ['fell', 'grassland', 'heath', 'scrub', 'shrubbery', 'tundra', 'grass', 'meadow', 'allotments', 'park', 'village_green', 'recreation_ground', 'garden', 'golf_course']
|
||||
wetland:
|
||||
subclass: ['wetland', 'bog', 'swamp', 'wet_meadow', 'marsh', 'reedbed', 'saltern', 'tidalflat', 'saltmarsh', 'mangrove']
|
||||
sand:
|
||||
|
@ -42,6 +46,7 @@ layer:
|
|||
- bog
|
||||
- dune
|
||||
- scrub
|
||||
- shrubbery
|
||||
- farm
|
||||
- farmland
|
||||
- fell
|
||||
|
|
|
@ -33,6 +33,7 @@ tables:
|
|||
- grassland
|
||||
- heath
|
||||
- scrub
|
||||
- shrubbery
|
||||
- tundra
|
||||
- glacier
|
||||
- bare_rock
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 65 KiB Po Szerokość: | Wysokość: | Rozmiar: 67 KiB |
|
@ -0,0 +1,476 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "landcover_classes",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landcover",
|
||||
"maxzoom": 13,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
"farmland",
|
||||
"#eef0d5",
|
||||
"wood",
|
||||
"#add19e",
|
||||
"rock",
|
||||
"#eee5dc",
|
||||
"grass",
|
||||
"#cdebb0",
|
||||
"sand",
|
||||
"#f5e9c6",
|
||||
"wetland",
|
||||
"#add19e",
|
||||
"#000"
|
||||
],
|
||||
"fill-opacity": {
|
||||
"stops": [
|
||||
[
|
||||
7,
|
||||
0.5
|
||||
],
|
||||
[
|
||||
10,
|
||||
1
|
||||
]
|
||||
]
|
||||
},
|
||||
"fill-antialias": false
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"farmland",
|
||||
"wood",
|
||||
"rock",
|
||||
"grass",
|
||||
"wetland",
|
||||
"sand"
|
||||
]
|
||||
],
|
||||
"order": 4
|
||||
},
|
||||
{
|
||||
"id": "landcover_class_outline",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landcover",
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "#c7c9ae",
|
||||
"line-width": 0.5
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"farmland"
|
||||
]
|
||||
],
|
||||
"order": 5
|
||||
},
|
||||
{
|
||||
"id": "landcover_park",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landcover",
|
||||
"minzoom": 13,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": "#c8facc",
|
||||
"fill-antialias": true
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"subclass",
|
||||
"park"
|
||||
]
|
||||
],
|
||||
"order": 6
|
||||
},
|
||||
{
|
||||
"id": "landcover_subclasses",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landcover",
|
||||
"minzoom": 13,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
],
|
||||
"allotments",
|
||||
"#c9e1bf",
|
||||
"bare_rock",
|
||||
"#eee5dc",
|
||||
"beach",
|
||||
"#fff1ba",
|
||||
"bog",
|
||||
"#d6d99f",
|
||||
"dune",
|
||||
"#f5e9c6",
|
||||
"scrub",
|
||||
"#c8d7ab",
|
||||
"farm",
|
||||
"#f5dcba",
|
||||
"farmland",
|
||||
"#eef0d5",
|
||||
"forest",
|
||||
"#add19e",
|
||||
"grass",
|
||||
"#cdebb0",
|
||||
"grassland",
|
||||
"#cdebb0",
|
||||
"golf_course",
|
||||
"#def6c0",
|
||||
"heath",
|
||||
"#d6d99f",
|
||||
"mangrove",
|
||||
"#c8d7ab",
|
||||
"meadow",
|
||||
"#cdebb0",
|
||||
"orchard",
|
||||
"#aedfa3",
|
||||
"park",
|
||||
"#c8facc",
|
||||
"garden",
|
||||
"#cdebb0",
|
||||
"plant_nursery",
|
||||
"#aedfa3",
|
||||
"recreation_ground",
|
||||
"#d5ffd9",
|
||||
"reedbed",
|
||||
"#cdebb0",
|
||||
"saltmarsh",
|
||||
"#cdebb0",
|
||||
"sand",
|
||||
"#f5e9c6",
|
||||
"scree",
|
||||
"#eee5dc",
|
||||
"swamp",
|
||||
"#add19e",
|
||||
"tidalflat",
|
||||
"#DED6CF",
|
||||
"village_green",
|
||||
"#cdebb0",
|
||||
"vineyard",
|
||||
"#aedfa3",
|
||||
"wet_meadow",
|
||||
"#cdebb0",
|
||||
"wetland",
|
||||
"#add19e",
|
||||
"wood",
|
||||
"#add19e",
|
||||
"marsh",
|
||||
"#ff0",
|
||||
"#FFFFFF"
|
||||
],
|
||||
"fill-antialias": true
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"subclass",
|
||||
"allotments",
|
||||
"bare_rock",
|
||||
"beach",
|
||||
"dune",
|
||||
"scrub",
|
||||
"farm",
|
||||
"farmland",
|
||||
"forest",
|
||||
"garden",
|
||||
"grass",
|
||||
"grassland",
|
||||
"golf_course",
|
||||
"heath",
|
||||
"meadow",
|
||||
"orchard",
|
||||
"plant_nursery",
|
||||
"recreation_ground",
|
||||
"reedbed",
|
||||
"saltmarsh",
|
||||
"sand",
|
||||
"scree",
|
||||
"swamp",
|
||||
"tidalflat",
|
||||
"tundra",
|
||||
"village_green",
|
||||
"vineyard",
|
||||
"wet_meadow",
|
||||
"wetland",
|
||||
"wood"
|
||||
]
|
||||
],
|
||||
"order": 7
|
||||
},
|
||||
{
|
||||
"id": "landcover_subclass_patterns",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landcover",
|
||||
"minzoom": 13,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-opacity": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
],
|
||||
"beach",
|
||||
0.4,
|
||||
"forest",
|
||||
0.4,
|
||||
"bare_rock",
|
||||
0.3,
|
||||
"scrub",
|
||||
0.6,
|
||||
"garden",
|
||||
0.6,
|
||||
"scree",
|
||||
0.3,
|
||||
"wood",
|
||||
0.4,
|
||||
1
|
||||
],
|
||||
"fill-pattern": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
],
|
||||
"allotments",
|
||||
"allotments",
|
||||
"bare_rock",
|
||||
"rock_overlay",
|
||||
"beach",
|
||||
"beach",
|
||||
"bog",
|
||||
"wetland_bog",
|
||||
"scrub",
|
||||
"scrub",
|
||||
"forest",
|
||||
"leaftype_unknown",
|
||||
"garden",
|
||||
"plant_nursery",
|
||||
"mangrove",
|
||||
"wetland_mangrove",
|
||||
"marsh",
|
||||
"wetland_marsh",
|
||||
"orchard",
|
||||
"orchard",
|
||||
"plant_nursery",
|
||||
"plant_nursery",
|
||||
"reedbed",
|
||||
"wetland_reed",
|
||||
"saltmarsh",
|
||||
"wetland_marsh",
|
||||
"scree",
|
||||
"scree_overlay",
|
||||
"swamp",
|
||||
"wetland_swamp",
|
||||
"vineyard",
|
||||
"vineyard",
|
||||
"wet_meadow",
|
||||
"wetland_marsh",
|
||||
"wetland",
|
||||
"wetland",
|
||||
"wood",
|
||||
"leaftype_unknown",
|
||||
""
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"subclass",
|
||||
"allotments",
|
||||
"bare_rock",
|
||||
"beach",
|
||||
"bog",
|
||||
"dune",
|
||||
"scrub",
|
||||
"farm",
|
||||
"farmland",
|
||||
"forest",
|
||||
"garden",
|
||||
"grass",
|
||||
"grassland",
|
||||
"golf_course",
|
||||
"heath",
|
||||
"mangrove",
|
||||
"marsh",
|
||||
"meadow",
|
||||
"orchard",
|
||||
"park",
|
||||
"plant_nursery",
|
||||
"recreation_ground",
|
||||
"reedbed",
|
||||
"saltern",
|
||||
"saltmarsh",
|
||||
"sand",
|
||||
"scree",
|
||||
"swamp",
|
||||
"village_green",
|
||||
"vineyard",
|
||||
"wet_meadow",
|
||||
"wetland",
|
||||
"wood"
|
||||
]
|
||||
],
|
||||
"order": 8
|
||||
},
|
||||
{
|
||||
"id": "landcover_subclass_outline",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landcover",
|
||||
"minzoom": 15,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
],
|
||||
"allotments",
|
||||
"#B1C6A8",
|
||||
"farm",
|
||||
"#d1b48c",
|
||||
"farmland",
|
||||
"#c7c9ae",
|
||||
"recreation_ground",
|
||||
"#3c6640",
|
||||
"#000"
|
||||
],
|
||||
"line-width": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"subclass"
|
||||
],
|
||||
"recreation_ground",
|
||||
0.3,
|
||||
0.5
|
||||
],
|
||||
"line-opacity": 1
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"subclass",
|
||||
"allotments",
|
||||
"farm",
|
||||
"farmland",
|
||||
"recreation_ground"
|
||||
]
|
||||
],
|
||||
"order": 9
|
||||
},
|
||||
{
|
||||
"id": "landcover_ice",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landcover",
|
||||
"minzoom": 5,
|
||||
"paint": {
|
||||
"fill-color": "#ddecec",
|
||||
"fill-antialias": false
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"ice"
|
||||
]
|
||||
],
|
||||
"order": 10
|
||||
},
|
||||
{
|
||||
"id": "landcover_ice_outline",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landcover",
|
||||
"minzoom": 5,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "#9cf",
|
||||
"line-width": {
|
||||
"stops": [
|
||||
[
|
||||
5,
|
||||
1
|
||||
],
|
||||
[
|
||||
10,
|
||||
1.5
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-dasharray": {
|
||||
"stops": [
|
||||
[
|
||||
5,
|
||||
[
|
||||
1,
|
||||
0
|
||||
]
|
||||
],
|
||||
[
|
||||
10,
|
||||
[
|
||||
4,
|
||||
2
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"ice"
|
||||
]
|
||||
],
|
||||
"order": 11
|
||||
}
|
||||
]
|
||||
}
|
Przed Szerokość: | Wysokość: | Rozmiar: 174 KiB Po Szerokość: | Wysokość: | Rozmiar: 333 KiB |
|
@ -35,6 +35,188 @@ WHERE scalerank <= 2
|
|||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS ne_50m_urban_areas_gen_z4_idx ON ne_50m_urban_areas_gen_z4 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen_z6 -> osm_landuse_polygon_gen_z6_union
|
||||
-- etldoc: osm_residential_gen_z6 -> osm_landuse_polygon_gen_z6_union
|
||||
CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z6_union AS
|
||||
(
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
amenity,
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z6
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
SELECT NULL::bigint AS osm_id,
|
||||
geometry,
|
||||
'residential' AS landuse,
|
||||
'' AS amenity,
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
FROM osm_residential_gen_z6
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen_z7 -> osm_landuse_polygon_gen_z7_union
|
||||
-- etldoc: osm_residential_gen_z7 -> osm_landuse_polygon_gen_z7_union
|
||||
CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z7_union AS
|
||||
(
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
amenity,
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z7
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
SELECT NULL::bigint AS osm_id,
|
||||
geometry,
|
||||
'residential' AS landuse,
|
||||
'' AS amenity,
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
FROM osm_residential_gen_z7
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen_z8 -> osm_landuse_polygon_gen_z8_union
|
||||
-- etldoc: osm_residential_gen_z8 -> osm_landuse_polygon_gen_z8_union
|
||||
CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z8_union AS
|
||||
(
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
amenity,
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z8
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
SELECT NULL::bigint AS osm_id,
|
||||
geometry,
|
||||
'residential' AS landuse,
|
||||
'' AS amenity,
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
FROM osm_residential_gen_z8
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen_z9 -> osm_landuse_polygon_gen_z9_union
|
||||
-- etldoc: osm_residential_gen_z9 -> osm_landuse_polygon_gen_z9_union
|
||||
CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z9_union AS
|
||||
(
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
amenity,
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z9
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
SELECT NULL::bigint AS osm_id,
|
||||
geometry,
|
||||
'residential' AS landuse,
|
||||
'' AS amenity,
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
FROM osm_residential_gen_z9
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen_z10 -> osm_landuse_polygon_gen_z10_union
|
||||
-- etldoc: osm_residential_gen_z10 -> osm_landuse_polygon_gen_z10_union
|
||||
CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z10_union AS
|
||||
(
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
amenity,
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z10
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
SELECT NULL::bigint AS osm_id,
|
||||
geometry,
|
||||
'residential' AS landuse,
|
||||
'' AS amenity,
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
FROM osm_residential_gen_z10
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen_z11 -> osm_landuse_polygon_gen_z11_union
|
||||
-- etldoc: osm_residential_gen_z11 -> osm_landuse_polygon_gen_z11_union
|
||||
CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z11_union AS
|
||||
(
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
amenity,
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z11
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
SELECT NULL::bigint AS osm_id,
|
||||
geometry,
|
||||
'residential' AS landuse,
|
||||
'' AS amenity,
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
FROM osm_residential_gen_z11
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen_z12 -> osm_landuse_polygon_gen_z12_union
|
||||
-- etldoc: osm_residential_gen_z12 -> osm_landuse_polygon_gen_z12_union
|
||||
CREATE OR REPLACE VIEW osm_landuse_polygon_gen_z12_union AS
|
||||
(
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
amenity,
|
||||
leisure,
|
||||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z12
|
||||
WHERE landuse <> 'residential'
|
||||
UNION ALL
|
||||
SELECT NULL::bigint AS osm_id,
|
||||
geometry,
|
||||
'residential' AS landuse,
|
||||
'' AS amenity,
|
||||
'' AS leisure,
|
||||
'' AS tourism,
|
||||
'' AS place,
|
||||
'' AS waterway
|
||||
FROM osm_residential_gen_z12
|
||||
);
|
||||
|
||||
-- etldoc: layer_landuse[shape=record fillcolor=lightpink, style="rounded,filled",
|
||||
-- etldoc: label="layer_landuse |<z4> z4|<z5> z5|<z6> z6|<z7> z7|<z8> z8|<z9> z9|<z10> z10|<z11> z11|<z12> z12|<z13> z13|<z14> z14+" ] ;
|
||||
|
||||
|
@ -83,7 +265,7 @@ FROM (
|
|||
FROM ne_50m_urban_areas_gen_z5
|
||||
WHERE zoom_level = 5
|
||||
UNION ALL
|
||||
-- etldoc: osm_landuse_polygon_gen_z6 -> layer_landuse:z6
|
||||
-- etldoc: osm_landuse_polygon_gen_z6_union -> layer_landuse:z6
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
|
@ -92,10 +274,10 @@ FROM (
|
|||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z6
|
||||
FROM osm_landuse_polygon_gen_z6_union
|
||||
WHERE zoom_level = 6
|
||||
UNION ALL
|
||||
-- etldoc: osm_landuse_polygon_gen_z7 -> layer_landuse:z7
|
||||
-- etldoc: osm_landuse_polygon_gen_z7_union -> layer_landuse:z7
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
|
@ -104,10 +286,10 @@ FROM (
|
|||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z7
|
||||
FROM osm_landuse_polygon_gen_z7_union
|
||||
WHERE zoom_level = 7
|
||||
UNION ALL
|
||||
-- etldoc: osm_landuse_polygon_gen_z8 -> layer_landuse:z8
|
||||
-- etldoc: osm_landuse_polygon_gen_z8_union -> layer_landuse:z8
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
|
@ -116,10 +298,10 @@ FROM (
|
|||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z8
|
||||
FROM osm_landuse_polygon_gen_z8_union
|
||||
WHERE zoom_level = 8
|
||||
UNION ALL
|
||||
-- etldoc: osm_landuse_polygon_gen_z9 -> layer_landuse:z9
|
||||
-- etldoc: osm_landuse_polygon_gen_z9_union -> layer_landuse:z9
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
|
@ -128,10 +310,10 @@ FROM (
|
|||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z9
|
||||
FROM osm_landuse_polygon_gen_z9_union
|
||||
WHERE zoom_level = 9
|
||||
UNION ALL
|
||||
-- etldoc: osm_landuse_polygon_gen_z10 -> layer_landuse:z10
|
||||
-- etldoc: osm_landuse_polygon_gen_z10_union -> layer_landuse:z10
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
|
@ -140,10 +322,10 @@ FROM (
|
|||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z10
|
||||
FROM osm_landuse_polygon_gen_z10_union
|
||||
WHERE zoom_level = 10
|
||||
UNION ALL
|
||||
-- etldoc: osm_landuse_polygon_gen_z11 -> layer_landuse:z11
|
||||
-- etldoc: osm_landuse_polygon_gen_z11_union -> layer_landuse:z11
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
|
@ -152,10 +334,10 @@ FROM (
|
|||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z11
|
||||
FROM osm_landuse_polygon_gen_z11_union
|
||||
WHERE zoom_level = 11
|
||||
UNION ALL
|
||||
-- etldoc: osm_landuse_polygon_gen_z12 -> layer_landuse:z12
|
||||
-- etldoc: osm_landuse_polygon_gen_z12_union -> layer_landuse:z12
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
landuse,
|
||||
|
@ -164,7 +346,7 @@ FROM (
|
|||
tourism,
|
||||
place,
|
||||
waterway
|
||||
FROM osm_landuse_polygon_gen_z12
|
||||
FROM osm_landuse_polygon_gen_z12_union
|
||||
WHERE zoom_level = 12
|
||||
UNION ALL
|
||||
-- etldoc: osm_landuse_polygon_gen_z13 -> layer_landuse:z13
|
||||
|
|
|
@ -44,11 +44,13 @@ layer:
|
|||
- quarter
|
||||
- neighbourhood
|
||||
- dam
|
||||
- quarry
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
query: (SELECT geometry, class FROM layer_landuse(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./class.sql
|
||||
- ./prep_landuse.sql
|
||||
- ./landuse.sql
|
||||
datasources:
|
||||
- type: imposm3
|
||||
|
|
|
@ -74,6 +74,7 @@ tables:
|
|||
- railway
|
||||
- cemetery
|
||||
- military
|
||||
- quarry
|
||||
# zoning
|
||||
- residential
|
||||
- commercial
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 62 KiB Po Szerokość: | Wysokość: | Rozmiar: 63 KiB |
|
@ -0,0 +1,176 @@
|
|||
DROP TABLE IF EXISTS cluster_zres14;
|
||||
CREATE TABLE cluster_zres14 AS
|
||||
(
|
||||
WITH single_geom AS (
|
||||
SELECT (ST_Dump(geometry)).geom AS geometry
|
||||
FROM osm_landuse_polygon
|
||||
WHERE landuse='residential'
|
||||
)
|
||||
SELECT ST_ClusterDBSCAN(geometry, eps := zres(14), minpoints := 1) over () AS cid,
|
||||
geometry
|
||||
FROM single_geom
|
||||
);
|
||||
CREATE INDEX ON cluster_zres14 USING gist(geometry);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS cluster_zres14_union;
|
||||
CREATE TABLE cluster_zres14_union AS (
|
||||
SELECT ST_Buffer(
|
||||
ST_Union(
|
||||
ST_Buffer(
|
||||
ST_SnapToGrid(geometry, 0.01)
|
||||
, zres(14), 'join=mitre'
|
||||
)
|
||||
),-zres(14), 'join=mitre'
|
||||
) AS geometry
|
||||
FROM cluster_zres14
|
||||
GROUP BY cid
|
||||
);
|
||||
CREATE INDEX ON cluster_zres14_union USING gist(geometry);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS cluster_zres12;
|
||||
CREATE TABLE cluster_zres12 AS
|
||||
(
|
||||
WITH single_geom AS (
|
||||
SELECT (ST_Dump(geometry)).geom AS geometry
|
||||
FROM osm_landuse_polygon
|
||||
WHERE landuse='residential'
|
||||
)
|
||||
SELECT ST_ClusterDBSCAN(geometry, eps := zres(12), minpoints := 1) over () AS cid,
|
||||
geometry
|
||||
FROM single_geom
|
||||
);
|
||||
CREATE INDEX ON cluster_zres12 USING gist(geometry);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS cluster_zres12_union;
|
||||
CREATE TABLE cluster_zres12_union AS
|
||||
(
|
||||
SELECT ST_Buffer(
|
||||
ST_Union(
|
||||
ST_Buffer(
|
||||
ST_SnapToGrid(geometry, 1)
|
||||
, zres(12), 'join=mitre'
|
||||
)
|
||||
), -zres(12), 'join=mitre'
|
||||
) AS geometry
|
||||
FROM cluster_zres12
|
||||
GROUP BY cid
|
||||
);
|
||||
CREATE INDEX ON cluster_zres12_union USING gist(geometry);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS cluster_zres9;
|
||||
CREATE TABLE cluster_zres9 AS
|
||||
(
|
||||
WITH single_geom AS (
|
||||
SELECT (ST_Dump(geometry)).geom AS geometry
|
||||
FROM osm_landuse_polygon
|
||||
WHERE landuse='residential'
|
||||
)
|
||||
SELECT ST_ClusterDBSCAN(geometry, eps := zres(9), minpoints := 1) over () AS cid,
|
||||
geometry
|
||||
FROM single_geom
|
||||
);
|
||||
CREATE INDEX ON cluster_zres9 USING gist(geometry);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS cluster_zres9_union;
|
||||
CREATE TABLE cluster_zres9_union AS
|
||||
(
|
||||
SELECT ST_Buffer(
|
||||
ST_Union(
|
||||
ST_Buffer(
|
||||
ST_SnapToGrid(geometry, 1)
|
||||
, zres(9), 'join=mitre'
|
||||
)
|
||||
), -zres(9), 'join=mitre'
|
||||
) AS geometry
|
||||
FROM cluster_zres9
|
||||
GROUP BY cid
|
||||
);
|
||||
CREATE INDEX ON cluster_zres9_union USING gist(geometry);
|
||||
|
||||
-- For z6
|
||||
-- etldoc: osm_landuse_polygon -> osm_residential_gen_z6
|
||||
DROP TABLE IF EXISTS osm_residential_gen_z6 CASCADE;
|
||||
CREATE TABLE osm_residential_gen_z6 AS
|
||||
(
|
||||
SELECT ST_SimplifyVW(geometry, power(zres(6), 2)) AS geometry
|
||||
FROM cluster_zres9_union
|
||||
WHERE ST_Area(geometry) > power(zres(6), 2)
|
||||
);
|
||||
CREATE INDEX ON osm_residential_gen_z6 USING gist(geometry);
|
||||
|
||||
|
||||
-- For z7
|
||||
-- etldoc: osm_landuse_polygon -> osm_residential_gen_z7
|
||||
DROP TABLE IF EXISTS osm_residential_gen_z7 CASCADE;
|
||||
CREATE TABLE osm_residential_gen_z7 AS
|
||||
(
|
||||
SELECT ST_SimplifyVW(geometry, power(zres(7), 2)) AS geometry
|
||||
FROM cluster_zres12_union
|
||||
WHERE ST_Area(geometry) > power(zres(6), 2)
|
||||
);
|
||||
CREATE INDEX ON osm_residential_gen_z7 USING gist(geometry);
|
||||
|
||||
|
||||
-- For z8
|
||||
-- etldoc: osm_landuse_polygon -> osm_residential_gen_z8
|
||||
DROP TABLE IF EXISTS osm_residential_gen_z8 CASCADE;
|
||||
CREATE TABLE osm_residential_gen_z8 AS
|
||||
(
|
||||
SELECT ST_SimplifyVW(geometry, power(zres(8), 2)) AS geometry
|
||||
FROM cluster_zres12_union
|
||||
WHERE ST_Area(geometry) > power(zres(7), 2)
|
||||
);
|
||||
CREATE INDEX ON osm_residential_gen_z8 USING gist(geometry);
|
||||
|
||||
|
||||
-- For z9
|
||||
-- etldoc: osm_landuse_polygon -> osm_residential_gen_z9
|
||||
DROP TABLE IF EXISTS osm_residential_gen_z9 CASCADE;
|
||||
CREATE TABLE osm_residential_gen_z9 AS
|
||||
(
|
||||
SELECT ST_SimplifyVW(geometry, power(zres(9), 2)) AS geometry
|
||||
FROM cluster_zres12_union
|
||||
WHERE ST_Area(geometry) > power(zres(9), 2)
|
||||
);
|
||||
CREATE INDEX ON osm_residential_gen_z9 USING gist(geometry);
|
||||
|
||||
|
||||
-- For z10
|
||||
-- etldoc: osm_landuse_polygon -> osm_residential_gen_z10
|
||||
DROP TABLE IF EXISTS osm_residential_gen_z10 CASCADE;
|
||||
CREATE TABLE osm_residential_gen_z10 AS
|
||||
(
|
||||
SELECT ST_SimplifyVW(geometry, power(zres(10), 2)) AS geometry
|
||||
FROM cluster_zres14_union
|
||||
WHERE ST_Area(geometry) > power(zres(10), 2)
|
||||
);
|
||||
CREATE INDEX ON osm_residential_gen_z10 USING gist(geometry);
|
||||
|
||||
|
||||
-- For z11
|
||||
-- etldoc: osm_landuse_polygon -> osm_residential_gen_z11
|
||||
DROP TABLE IF EXISTS osm_residential_gen_z11 CASCADE;
|
||||
CREATE TABLE osm_residential_gen_z11 AS
|
||||
(
|
||||
SELECT ST_SimplifyVW(geometry, power(zres(11), 2)) AS geometry
|
||||
FROM cluster_zres14_union
|
||||
WHERE ST_Area(geometry) > power(zres(11), 2)
|
||||
);
|
||||
CREATE INDEX ON osm_residential_gen_z11 USING gist(geometry);
|
||||
|
||||
|
||||
-- For z12
|
||||
-- etldoc: osm_landuse_polygon -> osm_residential_gen_z12
|
||||
DROP TABLE IF EXISTS osm_residential_gen_z12 CASCADE;
|
||||
CREATE TABLE osm_residential_gen_z12 AS
|
||||
(
|
||||
SELECT ST_SimplifyVW(geometry, power(zres(12), 2)) AS geometry
|
||||
FROM cluster_zres14_union
|
||||
WHERE ST_Area(geometry) > power(zres(12), 2)
|
||||
);
|
||||
CREATE INDEX ON osm_residential_gen_z12 USING gist(geometry);
|
|
@ -0,0 +1,369 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "landuse_classes",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landuse",
|
||||
"minzoom": 7,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
"railway",
|
||||
"#ebdbe8",
|
||||
"residential",
|
||||
"#e0dfdf",
|
||||
"cemetery",
|
||||
"#aacbaf",
|
||||
"military",
|
||||
"#fceaea",
|
||||
"commercial",
|
||||
"#f2dad9",
|
||||
"industrial",
|
||||
"#ebdbe8",
|
||||
"garages",
|
||||
"#dfddce",
|
||||
"retail",
|
||||
"#ffd6d1",
|
||||
"bus_station",
|
||||
"#e9e7e2",
|
||||
"school",
|
||||
"#ffffe5",
|
||||
"university",
|
||||
"#ffffe5",
|
||||
"kindergarten",
|
||||
"#ffffe5",
|
||||
"college",
|
||||
"#ffffe5",
|
||||
"hospital",
|
||||
"#ffffe5",
|
||||
"stadium",
|
||||
"#d5ffd9",
|
||||
"pitch",
|
||||
"#aae0cb",
|
||||
"playground",
|
||||
"#d5ffd9",
|
||||
"track",
|
||||
"#aae0cb",
|
||||
"dam",
|
||||
"#adadad",
|
||||
"#000"
|
||||
],
|
||||
"fill-opacity": 1
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"railway",
|
||||
"cemetery",
|
||||
"military",
|
||||
"residential",
|
||||
"commercial",
|
||||
"industrial",
|
||||
"garages",
|
||||
"retail",
|
||||
"bus_station",
|
||||
"school",
|
||||
"university",
|
||||
"kindergarten",
|
||||
"college",
|
||||
"hospital",
|
||||
"stadium",
|
||||
"pitch",
|
||||
"playground",
|
||||
"track",
|
||||
"dam"
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"$type",
|
||||
"Polygon"
|
||||
]
|
||||
],
|
||||
"order": 1
|
||||
},
|
||||
{
|
||||
"id": "landuse_residential",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landuse",
|
||||
"minzoom": 6,
|
||||
"maxzoom": 24,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": {
|
||||
"stops": [
|
||||
[
|
||||
7,
|
||||
"#d0d0d0"
|
||||
],
|
||||
[
|
||||
11,
|
||||
"#dddddd"
|
||||
],
|
||||
[
|
||||
12,
|
||||
"#e0dfdf"
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"residential",
|
||||
"suburbs",
|
||||
"neighbourhood"
|
||||
]
|
||||
],
|
||||
"order": 2
|
||||
},
|
||||
{
|
||||
"id": "landuse_class_pattern",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landuse",
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": "#000000",
|
||||
"fill-opacity": 1,
|
||||
"fill-pattern": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
"military",
|
||||
"military_red_hatch",
|
||||
"cemetery",
|
||||
"grave_yard_generic",
|
||||
""
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"military",
|
||||
"cemetery"
|
||||
]
|
||||
],
|
||||
"order": 25
|
||||
},
|
||||
{
|
||||
"id": "landuse_class_outline",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landuse",
|
||||
"minzoom": 13,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
"railway",
|
||||
"#c6b3c3",
|
||||
"military",
|
||||
"#ff5555",
|
||||
"residential",
|
||||
"#b9b9b9",
|
||||
"commercial",
|
||||
"#f2dad9",
|
||||
"industrial",
|
||||
"#c6b3c3",
|
||||
"retail",
|
||||
"#d99c95",
|
||||
"school",
|
||||
"#A6A68C",
|
||||
"university",
|
||||
"#A6A68C",
|
||||
"kindergarten",
|
||||
"#A6A68C",
|
||||
"college",
|
||||
"#A6A68C",
|
||||
"hospital",
|
||||
"#A6A68C",
|
||||
"stadium",
|
||||
"#7ca680",
|
||||
"pitch",
|
||||
"#7aaa97",
|
||||
"playground",
|
||||
"#3c6640",
|
||||
"track",
|
||||
"#7aaa96",
|
||||
"theme_park",
|
||||
"#660033",
|
||||
"zoo",
|
||||
"#660033",
|
||||
"dam",
|
||||
"#444444",
|
||||
"#000"
|
||||
],
|
||||
"line-width": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
"railway",
|
||||
0.7,
|
||||
"military",
|
||||
2,
|
||||
"residential",
|
||||
0.5,
|
||||
"commercial",
|
||||
0.5,
|
||||
"industrial",
|
||||
0.5,
|
||||
"retail",
|
||||
0.5,
|
||||
"school",
|
||||
0.3,
|
||||
"university",
|
||||
0.3,
|
||||
"kindergarten",
|
||||
0.3,
|
||||
"college",
|
||||
0.3,
|
||||
"hospital",
|
||||
0.3,
|
||||
"stadium",
|
||||
0.3,
|
||||
"pitch",
|
||||
0.5,
|
||||
"playground",
|
||||
0.3,
|
||||
"track",
|
||||
0.5,
|
||||
"theme_park",
|
||||
1,
|
||||
"zoo",
|
||||
1,
|
||||
"dam",
|
||||
2,
|
||||
1
|
||||
],
|
||||
"line-offset": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
"military",
|
||||
1,
|
||||
0
|
||||
],
|
||||
"line-opacity": [
|
||||
"match",
|
||||
[
|
||||
"get",
|
||||
"class"
|
||||
],
|
||||
"military",
|
||||
0.24,
|
||||
1
|
||||
]
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"railway",
|
||||
"military",
|
||||
"residential",
|
||||
"commercial",
|
||||
"industrial",
|
||||
"retail",
|
||||
"school",
|
||||
"university",
|
||||
"kindergarten",
|
||||
"college",
|
||||
"hospital",
|
||||
"stadium",
|
||||
"pitch",
|
||||
"playground",
|
||||
"track",
|
||||
"theme_park",
|
||||
"zoo",
|
||||
"dam"
|
||||
]
|
||||
],
|
||||
"order": 26
|
||||
},
|
||||
{
|
||||
"id": "landuse_class_themepark",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "landuse",
|
||||
"minzoom": 13,
|
||||
"layout": {
|
||||
"line-cap": "square",
|
||||
"line-join": "round",
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "#660033",
|
||||
"line-width": {
|
||||
"stops": [
|
||||
[
|
||||
9,
|
||||
3.5
|
||||
],
|
||||
[
|
||||
14,
|
||||
5.5
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-offset": 2,
|
||||
"line-opacity": {
|
||||
"stops": [
|
||||
[
|
||||
9,
|
||||
0.1
|
||||
],
|
||||
[
|
||||
12,
|
||||
0.3
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"theme_park",
|
||||
"zoo"
|
||||
]
|
||||
],
|
||||
"order": 27
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,13 +1,16 @@
|
|||
layer:
|
||||
id: "mountain_peak"
|
||||
requires:
|
||||
tables:
|
||||
- ne_10m_admin_0_countries
|
||||
description: |
|
||||
[Natural peaks](http://wiki.openstreetmap.org/wiki/Tag:natural%3Dpeak)
|
||||
buffer_size: 64
|
||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the peak.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the peak. Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
class:
|
||||
description: |
|
||||
Use the **class** to differentiate between natural objects.
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "mountain_peak",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "mountain_peak",
|
||||
"maxzoom": 16,
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"!in",
|
||||
"class",
|
||||
"cliff",
|
||||
"volcano"
|
||||
]
|
||||
],
|
||||
"layout": {
|
||||
"text-size": 10,
|
||||
"icon-image": "peak",
|
||||
"text-field": {
|
||||
"stops": [
|
||||
[
|
||||
6,
|
||||
" "
|
||||
],
|
||||
[
|
||||
12,
|
||||
"{name} {ele}m"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-anchor": "top",
|
||||
"text-offset": [
|
||||
0,
|
||||
0.5
|
||||
],
|
||||
"text-max-width": 6,
|
||||
"text-line-height": 1.1,
|
||||
"text-font": [
|
||||
"Noto Sans Regular",
|
||||
"Noto Sans Italic"
|
||||
]
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#6e441e",
|
||||
"text-halo-color": "rgba(255, 255, 255, .8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"order": 197
|
||||
},
|
||||
{
|
||||
"id": "mountain_peak_volcano",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "mountain_peak",
|
||||
"maxzoom": 16,
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"volcano"
|
||||
]
|
||||
],
|
||||
"layout": {
|
||||
"text-size": 10,
|
||||
"icon-image": "volcano",
|
||||
"text-field": {
|
||||
"stops": [
|
||||
[
|
||||
6,
|
||||
" "
|
||||
],
|
||||
[
|
||||
12,
|
||||
"{name} {ele}m"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-anchor": "top",
|
||||
"text-offset": [
|
||||
0,
|
||||
0.5
|
||||
],
|
||||
"text-max-width": 6,
|
||||
"text-line-height": 1.1,
|
||||
"text-font": [
|
||||
"Noto Sans Regular",
|
||||
"Noto Sans Italic"
|
||||
]
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#d40000",
|
||||
"text-halo-color": "rgba(255, 255, 255, .8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"order": 198
|
||||
}
|
||||
]
|
||||
}
|
|
@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS mountain_linestring;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS mountain_linestring.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: osm_mountain_linestring -> osm_mountain_linestring
|
||||
|
@ -26,11 +26,7 @@ SELECT update_osm_mountain_linestring(true);
|
|||
CREATE OR REPLACE FUNCTION mountain_linestring.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO mountain_linestring.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO mountain_linestring.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO mountain_linestring.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -55,6 +51,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh mountain_linestring';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE mountain_linestring.osm_ids;
|
||||
ANALYZE osm_mountain_linestring;
|
||||
|
||||
PERFORM update_osm_mountain_linestring(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM mountain_linestring.osm_ids;
|
||||
|
@ -67,13 +68,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_mountain_linestring
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE mountain_linestring.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_mountain_linestring
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE mountain_linestring.flag();
|
||||
|
|
|
@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS mountain_peak_point;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS mountain_peak_point.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: osm_peak_point -> osm_peak_point
|
||||
|
@ -26,11 +26,7 @@ SELECT update_osm_peak_point(true);
|
|||
CREATE OR REPLACE FUNCTION mountain_peak_point.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO mountain_peak_point.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO mountain_peak_point.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO mountain_peak_point.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -55,6 +51,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh mountain_peak_point';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE mountain_peak_point.osm_ids;
|
||||
ANALYZE osm_peak_point;
|
||||
|
||||
PERFORM update_osm_peak_point(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM mountain_peak_point.osm_ids;
|
||||
|
@ -67,13 +68,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_peak_point
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE mountain_peak_point.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_peak_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE mountain_peak_point.flag();
|
||||
|
|
|
@ -27,10 +27,10 @@ FROM (
|
|||
SELECT osm_id,
|
||||
geometry,
|
||||
COALESCE(
|
||||
LOWER(REPLACE(NULLIF(protection_title, ''), ' ', '_')),
|
||||
NULLIF(boundary, ''),
|
||||
NULLIF(leisure, '')
|
||||
) AS class,
|
||||
LOWER(REPLACE(NULLIF(protection_title, ''), ' ', '_')),
|
||||
NULLIF(boundary, ''),
|
||||
NULLIF(leisure, ''))
|
||||
AS class,
|
||||
name,
|
||||
name_en,
|
||||
name_de,
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
layer:
|
||||
id: "park"
|
||||
description: |
|
||||
The park layer contains parks from OpenStreetMap tagged with
|
||||
[`boundary=national_park`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dnational_park),
|
||||
[`boundary=protected_area`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dprotected_area),
|
||||
or [`leisure=nature_reserve`](http://wiki.openstreetmap.org/wiki/Tag:leisure%3Dnature_reserve).
|
||||
The park layer in OpenMapTiles contains natural and protected areas from OpenStreetMap,
|
||||
such as parks tagged with [`boundary=national_park`](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dnational_park),
|
||||
[`boundary=protected_area`](https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dprotected_area),
|
||||
or [`leisure=nature_reserve`](https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dnature_reserve).
|
||||
buffer_size: 4
|
||||
fields:
|
||||
class:
|
||||
description: |
|
||||
Use the **class** to differentiate between different parks.
|
||||
The class for `boundary=protected_area` parks is the lower-case of the
|
||||
[`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
|
||||
value with blanks replaced by `_`.
|
||||
`national_park` is the class of `protection_title=National Park` and `boundary=national_park`.
|
||||
`nature_reserve` is the class of `protection_title=Nature Reserve` and `leisure=nature_reserve`.
|
||||
The class for other [`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
|
||||
values is similarly assigned.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the park (point features only).
|
||||
name_en: English name `name:en` if available, otherwise `name` (point features only).
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en` (point features only).
|
||||
Use the **class** to differentiate between different kinds of features in the `parks` layer.
|
||||
The class for `boundary=protected_area` parks is the lower-case of the
|
||||
[`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
|
||||
value with blanks replaced by `_`.
|
||||
`national_park` is the class of `protection_title=National Park` and `boundary=national_park`.
|
||||
`nature_reserve` is the class of `protection_title=Nature Reserve` and `leisure=nature_reserve`.
|
||||
The class for other [`protection_title`](http://wiki.openstreetmap.org/wiki/key:protection_title)
|
||||
values is similarly assigned.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the park (point features only). Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name` (point features only). This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en` (point features only). This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
rank: Rank of the park within one tile, starting at 1 that is the most important park (point features only).
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "national_parks",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "park",
|
||||
"minzoom": 8,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "rgba(154, 199, 136, 1)",
|
||||
"line-width": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
8,
|
||||
1.2
|
||||
],
|
||||
[
|
||||
9,
|
||||
1.5
|
||||
],
|
||||
[
|
||||
10,
|
||||
3.6
|
||||
],
|
||||
[
|
||||
24,
|
||||
3.6
|
||||
]
|
||||
]
|
||||
},
|
||||
"line-offset": 1,
|
||||
"line-opacity": 0.8
|
||||
},
|
||||
"order": 20
|
||||
},
|
||||
{
|
||||
"id": "national_parks_thin",
|
||||
"type": "line",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "park",
|
||||
"minzoom": 10,
|
||||
"layout": {
|
||||
"visibility": "none"
|
||||
},
|
||||
"paint": {
|
||||
"line-color": "rgba(93, 156, 76, 1)",
|
||||
"line-width": 1.5
|
||||
},
|
||||
"order": 21
|
||||
},
|
||||
{
|
||||
"id": "park-national",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "park",
|
||||
"minzoom": 7,
|
||||
"maxzoom": 12,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Italic"
|
||||
],
|
||||
"text-size": 12,
|
||||
"text-field": "{name:latin}{name:nonlatin}",
|
||||
"visibility": "visible",
|
||||
"symbol-spacing": 150,
|
||||
"text-allow-overlap": false
|
||||
},
|
||||
"paint": {
|
||||
"text-color": {
|
||||
"stops": [
|
||||
[
|
||||
7,
|
||||
"rgba(70, 164, 70, 1)"
|
||||
],
|
||||
[
|
||||
10,
|
||||
"#008000"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-halo-blur": 0.1,
|
||||
"text-halo-color": {
|
||||
"stops": [
|
||||
[
|
||||
7,
|
||||
"rgba(241, 255, 234, 1)"
|
||||
],
|
||||
[
|
||||
10,
|
||||
"rgba(208, 250, 200, 1)"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-halo-width": 0.3
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"<=",
|
||||
"rank",
|
||||
2
|
||||
]
|
||||
],
|
||||
"order": 195
|
||||
}
|
||||
]
|
||||
}
|
|
@ -24,14 +24,16 @@ DROP MATERIALIZED VIEW IF EXISTS osm_park_polygon_dissolve_z4 CASCADE;
|
|||
CREATE MATERIALIZED VIEW osm_park_polygon_dissolve_z4 AS
|
||||
(
|
||||
SELECT min(osm_id) AS osm_id,
|
||||
ST_Union(geometry) AS geometry
|
||||
ST_Union(geometry) AS geometry,
|
||||
boundary
|
||||
FROM (
|
||||
SELECT ST_ClusterDBSCAN(geometry, 0, 1) OVER() AS cluster,
|
||||
osm_id,
|
||||
geometry
|
||||
geometry,
|
||||
boundary
|
||||
FROM osm_park_polygon_gen_z4
|
||||
) park_cluster
|
||||
GROUP BY cluster
|
||||
GROUP BY boundary, cluster
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS osm_park_polygon_dissolve_idx ON osm_park_polygon_dissolve_z4 (osm_id);
|
||||
|
||||
|
@ -46,6 +48,8 @@ DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z7;
|
|||
DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z6;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z5;
|
||||
DROP TRIGGER IF EXISTS update_row ON osm_park_polygon_gen_z4;
|
||||
DROP TRIGGER IF EXISTS trigger_flag ON osm_park_polygon;
|
||||
DROP TRIGGER IF EXISTS trigger_refresh ON park_polygon.updates;
|
||||
|
||||
-- etldoc: osm_park_polygon -> osm_park_polygon
|
||||
-- etldoc: osm_park_polygon_gen_z13 -> osm_park_polygon_gen_z13
|
||||
|
@ -63,43 +67,43 @@ $$
|
|||
BEGIN
|
||||
UPDATE osm_park_polygon
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z13
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z12
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z11
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z10
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z9
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z8
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z7
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z6
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
UPDATE osm_park_polygon_gen_z5
|
||||
SET tags = update_tags(tags, geometry),
|
||||
geometry_point = st_centroid(geometry);
|
||||
geometry_point = ST_PointOnSurface(geometry);
|
||||
|
||||
REFRESH MATERIALIZED VIEW CONCURRENTLY osm_park_polygon_dissolve_z4;
|
||||
END;
|
||||
|
@ -119,13 +123,49 @@ CREATE INDEX IF NOT EXISTS osm_park_polygon_gen_z5_point_geom_idx ON osm_park_po
|
|||
CREATE INDEX IF NOT EXISTS osm_park_polygon_gen_z4_polygon_geom_idx ON osm_park_polygon_gen_z4 USING gist (geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_park_polygon_dissolve_z4_polygon_geom_idx ON osm_park_polygon_dissolve_z4 USING gist (geometry);
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS park_polygon;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS park_polygon.updates
|
||||
(
|
||||
id serial PRIMARY KEY,
|
||||
t text,
|
||||
UNIQUE (t)
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION park_polygon.flag() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
INSERT INTO park_polygon.updates(t) VALUES ('y') ON CONFLICT(t) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION park_polygon.refresh() RETURNS trigger AS
|
||||
$$
|
||||
DECLARE
|
||||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh park_polygon';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE osm_park_polygon_gen_z4;
|
||||
REFRESH MATERIALIZED VIEW osm_park_polygon_dissolve_z4;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM park_polygon.updates;
|
||||
|
||||
RAISE LOG 'Refresh park_polygon done in %', age(clock_timestamp(), t);
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_osm_park_polygon_row()
|
||||
RETURNS trigger
|
||||
AS
|
||||
$$
|
||||
BEGIN
|
||||
NEW.tags = update_tags(NEW.tags, NEW.geometry);
|
||||
NEW.geometry_point = st_centroid(NEW.geometry);
|
||||
NEW.geometry_point = ST_PointOnSurface(NEW.geometry);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -206,3 +246,15 @@ CREATE TRIGGER update_row
|
|||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE update_osm_park_dissolved_polygon_row();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
ON osm_park_polygon
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE park_polygon.flag();
|
||||
|
||||
CREATE CONSTRAINT TRIGGER trigger_refresh
|
||||
AFTER INSERT
|
||||
ON park_polygon.updates
|
||||
INITIALLY DEFERRED
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE park_polygon.refresh();
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
CREATE OR REPLACE FUNCTION area_rank(area real) RETURNS int AS
|
||||
$$
|
||||
SELECT CASE
|
||||
WHEN area > 640000000 THEN 1
|
||||
WHEN area > 160000000 THEN 2
|
||||
WHEN area > 40000000 THEN 3
|
||||
WHEN area > 15000000 THEN 4
|
||||
WHEN area > 10000000 THEN 5
|
||||
WHEN area > 0 THEN 6
|
||||
ELSE 7
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
STRICT
|
||||
PARALLEL SAFE;
|
|
@ -2,8 +2,8 @@ CREATE OR REPLACE FUNCTION normalize_capital_level(capital text)
|
|||
RETURNS int AS
|
||||
$$
|
||||
SELECT CASE
|
||||
WHEN capital IN ('yes', '2') THEN 2
|
||||
WHEN capital = '4' THEN 4
|
||||
WHEN capital = 'yes' THEN 2
|
||||
WHEN capital IN ('2', '3', '4', '5', '6') THEN capital::int
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
STRICT
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 136 KiB Po Szerokość: | Wysokość: | Rozmiar: 152 KiB |
|
@ -1,12 +0,0 @@
|
|||
CREATE OR REPLACE FUNCTION island_rank(area real) RETURNS int AS
|
||||
$$
|
||||
SELECT CASE
|
||||
WHEN area < 10000000 THEN 6
|
||||
WHEN area BETWEEN 1000000 AND 15000000 THEN 5
|
||||
WHEN area BETWEEN 15000000 AND 40000000 THEN 4
|
||||
WHEN area > 40000000 THEN 3
|
||||
ELSE 7
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE
|
||||
STRICT
|
||||
PARALLEL SAFE;
|
|
@ -177,6 +177,7 @@ tables:
|
|||
- town
|
||||
- village
|
||||
- hamlet
|
||||
- borough
|
||||
- suburb
|
||||
- quarter
|
||||
- neighbourhood
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 53 KiB Po Szerokość: | Wysokość: | Rozmiar: 55 KiB |
|
@ -109,17 +109,39 @@ FROM (
|
|||
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
||||
tags,
|
||||
'island' AS class,
|
||||
island_rank(area) AS "rank",
|
||||
area_rank(area) AS "rank",
|
||||
NULL::int AS capital,
|
||||
NULL::text AS iso_a2
|
||||
FROM osm_island_polygon
|
||||
WHERE geometry && bbox
|
||||
AND ((zoom_level = 8 AND island_rank(area) <= 3)
|
||||
OR (zoom_level = 9 AND island_rank(area) <= 4)
|
||||
AND ((zoom_level = 8 AND area_rank(area) <= 3)
|
||||
OR (zoom_level = 9 AND area_rank(area) <= 4)
|
||||
OR (zoom_level >= 10))
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
-- etldoc: osm_boundary_polygon -> layer_place:z6_11
|
||||
-- etldoc: osm_boundary_polygon -> layer_place:z12_14
|
||||
osm_id * 10 AS osm_id,
|
||||
geometry_point,
|
||||
name,
|
||||
NULL::text AS name_en, -- deprecated
|
||||
NULL::text AS name_de, -- deprecated
|
||||
tags,
|
||||
'aboriginal_lands' AS class,
|
||||
area_rank(area) AS "rank",
|
||||
NULL::int AS capital,
|
||||
NULL::text AS iso_a2
|
||||
FROM osm_boundary_polygon
|
||||
WHERE geometry_point && bbox
|
||||
AND ((zoom_level = 6 AND area_rank(area) <= 1)
|
||||
OR (zoom_level = 7 AND area_rank(area) <= 2)
|
||||
OR (zoom_level = 8 AND area_rank(area) <= 3)
|
||||
OR (zoom_level = 9 AND area_rank(area) <= 4)
|
||||
OR (zoom_level >= 10))
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
-- etldoc: layer_city -> layer_place:z0_3
|
||||
-- etldoc: layer_city -> layer_place:z4_7
|
||||
|
|
|
@ -4,7 +4,9 @@ layer:
|
|||
tables:
|
||||
- ne_10m_admin_1_states_provinces
|
||||
- ne_10m_admin_0_countries
|
||||
- ne_10m_admin_1_states_provinces
|
||||
- ne_10m_populated_places
|
||||
layers:
|
||||
- boundary
|
||||
description: |
|
||||
The place layer consists out of [countries](http://wiki.openstreetmap.org/wiki/Tag:place%3Dcountry),
|
||||
[states](http://wiki.openstreetmap.org/wiki/Tag:place%3Dstate), [cities](http://wiki.openstreetmap.org/wiki/Key:place)
|
||||
|
@ -12,15 +14,15 @@ layer:
|
|||
Apart from the roads this is also one of the more important layers to create a beautiful map.
|
||||
We suggest you use different font styles and sizes to create a text hierarchy.
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the place. Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
capital:
|
||||
description: |
|
||||
The **capital** field marks the
|
||||
[`admin_level`](http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level)
|
||||
of the boundary the place is a capital of.
|
||||
values: [2, 4]
|
||||
values: [2, 3, 4, 5, 6]
|
||||
class:
|
||||
description: |
|
||||
Original value of the
|
||||
|
@ -28,7 +30,9 @@ layer:
|
|||
Distinguish between continents, countries, states, islands and
|
||||
places like settlements or smaller entities.
|
||||
Use **class** to separately style the different places and build
|
||||
a text hierarchy according to their importance.
|
||||
a text hierarchy according to their importance. For places derived
|
||||
from boundaries, the original value of the
|
||||
[`boundary`](http://wiki.openstreetmap.org/wiki/Key:boundary) tag.
|
||||
values:
|
||||
- continent
|
||||
- country
|
||||
|
@ -38,11 +42,13 @@ layer:
|
|||
- town
|
||||
- village
|
||||
- hamlet
|
||||
- borough
|
||||
- suburb
|
||||
- quarter
|
||||
- neighbourhood
|
||||
- isolated_dwelling
|
||||
- island
|
||||
- aboriginal_lands
|
||||
iso_a2:
|
||||
description: |
|
||||
Two-letter country code [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). Available only for `class=country`.
|
||||
|
@ -74,7 +80,7 @@ schema:
|
|||
- ./types.sql
|
||||
- ./capital.sql
|
||||
- ./city.sql
|
||||
- ./island_rank.sql
|
||||
- ./area_rank.sql
|
||||
- ./update_continent_point.sql
|
||||
- ./update_country_point.sql
|
||||
- ./update_island_polygon.sql
|
||||
|
|
|
@ -0,0 +1,662 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "place_other",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 8,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"base": 1.2,
|
||||
"stops": [
|
||||
[
|
||||
11,
|
||||
10
|
||||
],
|
||||
[
|
||||
14,
|
||||
14
|
||||
],
|
||||
[
|
||||
18,
|
||||
16
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}\n{name:nonlatin}",
|
||||
"visibility": "visible",
|
||||
"symbol-spacing": 150,
|
||||
"text-max-width": 10,
|
||||
"text-transform": "none"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": {
|
||||
"stops": [
|
||||
[
|
||||
12.5,
|
||||
"#222222"
|
||||
],
|
||||
[
|
||||
12.6,
|
||||
"#777777"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-halo-blur": 0,
|
||||
"text-halo-color": {
|
||||
"stops": [
|
||||
[
|
||||
11,
|
||||
"rgba(255,255,255,0.6)"
|
||||
],
|
||||
[
|
||||
13,
|
||||
"#ffffff"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-halo-width": {
|
||||
"stops": [
|
||||
[
|
||||
8,
|
||||
0.8
|
||||
],
|
||||
[
|
||||
13,
|
||||
1.5
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"in",
|
||||
"class",
|
||||
"hamlet",
|
||||
"island",
|
||||
"islet",
|
||||
"neighbourhood",
|
||||
"suburb",
|
||||
"borough"
|
||||
]
|
||||
],
|
||||
"order": 193
|
||||
},
|
||||
{
|
||||
"id": "place_village",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 8,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"base": 1.2,
|
||||
"stops": [
|
||||
[
|
||||
10,
|
||||
10
|
||||
],
|
||||
[
|
||||
15,
|
||||
16
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}\n{name:nonlatin}",
|
||||
"visibility": "visible",
|
||||
"text-max-width": 8
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#333",
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 1.2
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"village"
|
||||
]
|
||||
],
|
||||
"order": 199
|
||||
},
|
||||
{
|
||||
"id": "place_town",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 6,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"base": 1.2,
|
||||
"stops": [
|
||||
[
|
||||
7,
|
||||
10
|
||||
],
|
||||
[
|
||||
11,
|
||||
13
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}\n{name:nonlatin}",
|
||||
"visibility": "visible",
|
||||
"text-anchor": "bottom",
|
||||
"text-offset": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"text-max-width": 8
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#333",
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 1.2
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"town"
|
||||
]
|
||||
],
|
||||
"order": 200
|
||||
},
|
||||
{
|
||||
"id": "place_state",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 4,
|
||||
"maxzoom": 12,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular",
|
||||
"Noto Sans Bold"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
10
|
||||
],
|
||||
[
|
||||
6,
|
||||
14
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}",
|
||||
"visibility": "visible",
|
||||
"text-padding": 2,
|
||||
"text-transform": "none",
|
||||
"text-letter-spacing": 0
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#7e587d",
|
||||
"text-halo-color": "rgba(255,255,255,0.7)",
|
||||
"text-halo-width": 0.8
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"state"
|
||||
],
|
||||
[
|
||||
"<",
|
||||
"rank",
|
||||
3
|
||||
]
|
||||
],
|
||||
"order": 201
|
||||
},
|
||||
{
|
||||
"id": "place_city",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 4,
|
||||
"maxzoom": 14,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"base": 1.2,
|
||||
"stops": [
|
||||
[
|
||||
4,
|
||||
12
|
||||
],
|
||||
[
|
||||
15,
|
||||
18
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": {
|
||||
"stops": [
|
||||
[
|
||||
4,
|
||||
"place-6"
|
||||
],
|
||||
[
|
||||
7,
|
||||
" "
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}\n{name:nonlatin}",
|
||||
"visibility": "visible",
|
||||
"icon-offset": [
|
||||
0,
|
||||
3
|
||||
],
|
||||
"text-anchor": "bottom",
|
||||
"text-offset": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"icon-optional": false,
|
||||
"text-max-width": 8,
|
||||
"icon-allow-overlap": true
|
||||
},
|
||||
"paint": {
|
||||
"text-color": {
|
||||
"stops": [
|
||||
[
|
||||
6,
|
||||
"rgba(88, 88, 88, 1)"
|
||||
],
|
||||
[
|
||||
14,
|
||||
"rgba(32, 32, 32, 1)"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"city"
|
||||
],
|
||||
[
|
||||
"!=",
|
||||
"rank",
|
||||
1
|
||||
]
|
||||
],
|
||||
"order": 202
|
||||
},
|
||||
{
|
||||
"id": "place_capital",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 3,
|
||||
"maxzoom": 15,
|
||||
"layout": {
|
||||
"icon-size": 1,
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"base": 1.2,
|
||||
"stops": [
|
||||
[
|
||||
4,
|
||||
11
|
||||
],
|
||||
[
|
||||
12,
|
||||
16
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": {
|
||||
"stops": [
|
||||
[
|
||||
6,
|
||||
"place-capital-8"
|
||||
],
|
||||
[
|
||||
8,
|
||||
""
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}\n{name:nonlatin}",
|
||||
"visibility": "visible",
|
||||
"icon-offset": [
|
||||
0,
|
||||
3
|
||||
],
|
||||
"text-anchor": "bottom",
|
||||
"text-offset": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"icon-optional": false,
|
||||
"text-max-width": 8,
|
||||
"icon-allow-overlap": true
|
||||
},
|
||||
"paint": {
|
||||
"text-color": {
|
||||
"stops": [
|
||||
[
|
||||
6,
|
||||
"rgba(73, 73, 73, 1)"
|
||||
],
|
||||
[
|
||||
14,
|
||||
"rgba(32, 32, 32, 1)"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 1.2
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"city"
|
||||
],
|
||||
[
|
||||
"in",
|
||||
"capital",
|
||||
1,
|
||||
2
|
||||
]
|
||||
],
|
||||
"order": 203
|
||||
},
|
||||
{
|
||||
"id": "country_other",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 4,
|
||||
"maxzoom": 15,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
11
|
||||
],
|
||||
[
|
||||
5,
|
||||
13
|
||||
],
|
||||
[
|
||||
7,
|
||||
20
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}",
|
||||
"visibility": "visible",
|
||||
"text-max-width": 6.25,
|
||||
"text-transform": "none"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "rgba(131, 81, 130, 1)",
|
||||
"text-halo-blur": 1,
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 0.8
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"country"
|
||||
],
|
||||
[
|
||||
"!has",
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 204
|
||||
},
|
||||
{
|
||||
"id": "country_3",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 5,
|
||||
"maxzoom": 12,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Bold"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
11
|
||||
],
|
||||
[
|
||||
5,
|
||||
13
|
||||
],
|
||||
[
|
||||
7,
|
||||
17
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}",
|
||||
"visibility": "visible",
|
||||
"text-max-width": 6.25,
|
||||
"text-transform": "none"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": {
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
"rgba(108, 78, 107, 1)"
|
||||
],
|
||||
[
|
||||
10,
|
||||
"rgba(57, 37, 73, 1)"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-halo-blur": 1,
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 0.8
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
">=",
|
||||
"rank",
|
||||
3
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"country"
|
||||
],
|
||||
[
|
||||
"has",
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 205
|
||||
},
|
||||
{
|
||||
"id": "country_2",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 2,
|
||||
"maxzoom": 12,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Bold"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
11
|
||||
],
|
||||
[
|
||||
5,
|
||||
14
|
||||
],
|
||||
[
|
||||
7,
|
||||
19
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}",
|
||||
"visibility": "visible",
|
||||
"text-max-width": 6.25,
|
||||
"text-transform": "none"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": {
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
"rgba(108, 78, 107, 1)"
|
||||
],
|
||||
[
|
||||
10,
|
||||
"rgba(57, 37, 73, 1)"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-halo-blur": 1,
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 0.8
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"rank",
|
||||
2
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"country"
|
||||
],
|
||||
[
|
||||
"has",
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 206
|
||||
},
|
||||
{
|
||||
"id": "country_1",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "place",
|
||||
"minzoom": 2,
|
||||
"maxzoom": 12,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Bold"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
3,
|
||||
11
|
||||
],
|
||||
[
|
||||
5,
|
||||
14
|
||||
],
|
||||
[
|
||||
7,
|
||||
19
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name:latin}",
|
||||
"visibility": "visible",
|
||||
"text-max-width": 6.25,
|
||||
"text-transform": "none"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": {
|
||||
"stops": [
|
||||
[
|
||||
2,
|
||||
"rgba(108, 78, 107, 1)"
|
||||
],
|
||||
[
|
||||
10,
|
||||
"rgba(57, 37, 73, 1)"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-halo-blur": 1,
|
||||
"text-halo-color": "rgba(255,255,255,0.8)",
|
||||
"text-halo-width": 0.8
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"rank",
|
||||
1
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"country"
|
||||
],
|
||||
[
|
||||
"has",
|
||||
"iso_a2"
|
||||
]
|
||||
],
|
||||
"order": 207
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
IF NOT EXISTS(SELECT 1 FROM pg_type WHERE typname = 'city_place') THEN
|
||||
CREATE TYPE city_place AS enum ('city', 'town', 'village', 'hamlet', 'suburb', 'quarter', 'neighbourhood', 'isolated_dwelling');
|
||||
END IF;
|
||||
PERFORM 'city_place'::regtype;
|
||||
EXCEPTION
|
||||
WHEN undefined_object THEN
|
||||
CREATE TYPE city_place AS enum ('city', 'town', 'village', 'hamlet', 'borough', 'suburb', 'quarter', 'neighbourhood', 'isolated_dwelling');
|
||||
END
|
||||
$$;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ CREATE SCHEMA IF NOT EXISTS place_city;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS place_city.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_osm_city_point(full_update boolean) RETURNS void AS
|
||||
|
@ -23,8 +23,8 @@ $$
|
|||
LEFT JOIN ne_10m_populated_places AS ne ON
|
||||
(
|
||||
(osm.tags ? 'wikidata' AND osm.tags->'wikidata' = ne.wikidataid) OR
|
||||
lower(osm.name) IN (lower(ne.name), lower(ne.namealt), lower(ne.meganame), lower(ne.gn_ascii), lower(ne.nameascii)) OR
|
||||
lower(osm.name_en) IN (lower(ne.name), lower(ne.namealt), lower(ne.meganame), lower(ne.gn_ascii), lower(ne.nameascii)) OR
|
||||
lower(osm.name) IN (lower(ne.name), lower(ne.namealt), lower(ne.meganame), lower(ne.name_en), lower(ne.nameascii)) OR
|
||||
lower(osm.name_en) IN (lower(ne.name), lower(ne.namealt), lower(ne.meganame), lower(ne.name_en), lower(ne.nameascii)) OR
|
||||
ne.name = unaccent(osm.name)
|
||||
)
|
||||
AND osm.place IN ('city', 'town', 'village')
|
||||
|
@ -49,18 +49,12 @@ $$ LANGUAGE SQL;
|
|||
|
||||
SELECT update_osm_city_point(true);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_city_point_rank_idx ON osm_city_point ("rank");
|
||||
|
||||
-- Handle updates
|
||||
|
||||
CREATE OR REPLACE FUNCTION place_city.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO place_city.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO place_city.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO place_city.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -85,6 +79,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh place_city rank';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE place_city.osm_ids;
|
||||
ANALYZE osm_city_point;
|
||||
|
||||
PERFORM update_osm_city_point(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM place_city.osm_ids;
|
||||
|
@ -97,13 +96,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_city_point
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE place_city.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_city_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE place_city.flag();
|
||||
|
|
|
@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_continent_point;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS place_continent_point.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: osm_continent_point -> osm_continent_point
|
||||
|
@ -26,11 +26,7 @@ SELECT update_osm_continent_point(true);
|
|||
CREATE OR REPLACE FUNCTION place_continent_point.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO place_continent_point.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO place_continent_point.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO place_continent_point.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -55,6 +51,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh place_continent_point';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE place_continent_point.osm_ids;
|
||||
ANALYZE osm_continent_point;
|
||||
|
||||
PERFORM update_osm_continent_point(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM place_continent_point.osm_ids;
|
||||
|
@ -67,13 +68,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_continent_point
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE place_continent_point.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_continent_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE place_continent_point.flag();
|
||||
|
|
|
@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_country;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS place_country.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: ne_10m_admin_0_countries -> osm_country_point
|
||||
|
@ -98,18 +98,12 @@ $$ LANGUAGE SQL;
|
|||
|
||||
SELECT update_osm_country_point(true);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_country_point_rank_idx ON osm_country_point ("rank");
|
||||
|
||||
-- Handle updates
|
||||
|
||||
CREATE OR REPLACE FUNCTION place_country.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO place_country.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO place_country.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO place_country.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -134,6 +128,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh place_country rank';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE place_country.osm_ids;
|
||||
ANALYZE osm_country_point;
|
||||
|
||||
PERFORM update_osm_country_point(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM place_country.osm_ids;
|
||||
|
@ -146,13 +145,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_country_point
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE place_country.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_country_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE place_country.flag();
|
||||
|
|
|
@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_island_point;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS place_island_point.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: osm_island_point -> osm_island_point
|
||||
|
@ -26,11 +26,7 @@ SELECT update_osm_island_point(true);
|
|||
CREATE OR REPLACE FUNCTION place_island_point.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO place_island_point.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO place_island_point.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO place_island_point.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -55,6 +51,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh place_island_point';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE place_island_point.osm_ids;
|
||||
ANALYZE osm_island_point;
|
||||
|
||||
PERFORM update_osm_island_point(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM place_island_point.osm_ids;
|
||||
|
@ -67,13 +68,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_island_point
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE place_island_point.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_island_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE place_island_point.flag();
|
||||
|
|
|
@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_island_polygon;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS place_island_polygon.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: osm_island_polygon -> osm_island_polygon
|
||||
|
@ -33,11 +33,7 @@ SELECT update_osm_island_polygon(true);
|
|||
CREATE OR REPLACE FUNCTION place_island_polygon.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO place_island_polygon.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO place_island_polygon.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO place_island_polygon.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -62,6 +58,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh place_island_polygon';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE place_island_polygon.osm_ids;
|
||||
ANALYZE osm_island_polygon;
|
||||
|
||||
PERFORM update_osm_island_polygon(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM place_island_polygon.osm_ids;
|
||||
|
@ -74,13 +75,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_island_polygon
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE place_island_polygon.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_island_polygon
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE place_island_polygon.flag();
|
||||
|
|
|
@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS place_state;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS place_state.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: ne_10m_admin_1_states_provinces -> osm_state_point
|
||||
|
@ -60,18 +60,12 @@ $$ LANGUAGE SQL;
|
|||
|
||||
SELECT update_osm_state_point(true);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_state_point_rank_idx ON osm_state_point ("rank");
|
||||
|
||||
-- Handle updates
|
||||
|
||||
CREATE OR REPLACE FUNCTION place_state.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO place_state.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO place_state.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO place_state.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -96,6 +90,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh place_state rank';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE place_state.osm_ids;
|
||||
ANALYZE osm_state_point;
|
||||
|
||||
PERFORM update_osm_state_point(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM place_state.osm_ids;
|
||||
|
@ -108,13 +107,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_state_point
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE place_state.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_state_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE place_state.flag();
|
||||
|
|
|
@ -33,6 +33,8 @@ CREATE OR REPLACE FUNCTION poi_class(subclass text, mapping_key text)
|
|||
RETURNS text AS
|
||||
$$
|
||||
SELECT CASE
|
||||
-- Special case subclass collision between office=university and amenity=university
|
||||
WHEN mapping_key = 'amenity' AND subclass = 'university' THEN 'college'
|
||||
%%FIELD_MAPPING: class %%
|
||||
ELSE subclass
|
||||
END;
|
||||
|
|
|
@ -18,6 +18,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity
|
|||
- biergarten
|
||||
- bus_station
|
||||
- cafe
|
||||
- charging_station
|
||||
- cinema
|
||||
- clinic
|
||||
- college
|
||||
|
@ -44,6 +45,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity
|
|||
- pharmacy
|
||||
- place_of_worship
|
||||
- police
|
||||
- parcel_locker
|
||||
- post_box
|
||||
- post_office
|
||||
- prison
|
||||
|
@ -117,7 +119,66 @@ def_poi_mapping_leisure: &poi_mapping_leisure
|
|||
|
||||
# office values , see http://taginfo.openstreetmap.org/keys/office#values
|
||||
def_poi_mapping_office: &poi_mapping_office
|
||||
- accountant
|
||||
- advertising_agency
|
||||
- architect
|
||||
- association
|
||||
- bail_bond_agent
|
||||
- charity
|
||||
- company
|
||||
- construction_company
|
||||
- consulting
|
||||
- cooperative
|
||||
- courier
|
||||
- coworking
|
||||
- diplomatic
|
||||
- educational_institution
|
||||
- employment_agency
|
||||
- energy_supplier
|
||||
- engineer
|
||||
- estate_agent
|
||||
- financial
|
||||
- financial_advisor
|
||||
- forestry
|
||||
- foundation
|
||||
- geodesist
|
||||
- government
|
||||
- graphic_design
|
||||
- guide
|
||||
- harbour_master
|
||||
- health_insurance
|
||||
- insurance
|
||||
- interior_design
|
||||
- it
|
||||
- lawyer
|
||||
- logistics
|
||||
- marketing
|
||||
- moving_company
|
||||
- newspaper
|
||||
- ngo
|
||||
- notary
|
||||
- physician
|
||||
- political_party
|
||||
- private_investigator
|
||||
- property_management
|
||||
- publisher
|
||||
- quango
|
||||
- religion
|
||||
- research
|
||||
- security
|
||||
- surveyor
|
||||
- tax_advisor
|
||||
- taxi
|
||||
- telecommunication
|
||||
- therapist
|
||||
- translator
|
||||
- travel_agent
|
||||
- tutoring
|
||||
- union
|
||||
- university
|
||||
- water_utility
|
||||
- web_design
|
||||
- wedding_planner
|
||||
|
||||
# railway values , see http://taginfo.openstreetmap.org/keys/railway#values
|
||||
def_poi_mapping_railway: &poi_mapping_railway
|
||||
|
@ -192,6 +253,7 @@ def_poi_mapping_shop: &poi_mapping_shop
|
|||
- newsagent
|
||||
- optician
|
||||
- outdoor
|
||||
- paint
|
||||
- perfume
|
||||
- perfumery
|
||||
- pet
|
||||
|
@ -326,6 +388,8 @@ def_poi_fields: &poi_fields
|
|||
type: id
|
||||
- name: geometry
|
||||
type: geometry
|
||||
- name: area
|
||||
type: area
|
||||
- name: name
|
||||
key: name
|
||||
type: string
|
||||
|
@ -353,6 +417,9 @@ def_poi_fields: &poi_fields
|
|||
- name: uic_ref
|
||||
key: uic_ref
|
||||
type: string
|
||||
- name: ref
|
||||
key: ref
|
||||
type: string
|
||||
- name: religion
|
||||
key: religion
|
||||
type: string
|
||||
|
@ -374,6 +441,9 @@ def_poi_fields: &poi_fields
|
|||
- name: network
|
||||
key: network
|
||||
type: string
|
||||
- name: brand
|
||||
key: brand
|
||||
type: string
|
||||
|
||||
def_poi_mapping: &poi_mapping
|
||||
aerialway: *poi_mapping_aerialway
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 1.4 MiB Po Szerokość: | Wysokość: | Rozmiar: 1.7 MiB |
|
@ -68,20 +68,6 @@ FROM (
|
|||
|
||||
-- etldoc: osm_poi_polygon -> layer_poi:z12
|
||||
-- etldoc: osm_poi_polygon -> layer_poi:z13
|
||||
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,
|
||||
|
@ -90,8 +76,21 @@ FROM (
|
|||
ELSE osm_id * 10 + 1
|
||||
END AS osm_id_hash
|
||||
FROM osm_poi_polygon
|
||||
WHERE geometry && bbox
|
||||
AND zoom_level >= 14
|
||||
WHERE geometry && bbox AND
|
||||
CASE
|
||||
WHEN zoom_level >= 14 THEN TRUE
|
||||
WHEN zoom_level >= 12 AND
|
||||
((subclass = 'station' AND mapping_key = 'railway')
|
||||
OR subclass IN ('halt', 'ferry_terminal')) THEN TRUE
|
||||
WHEN zoom_level BETWEEN 10 AND 14 THEN
|
||||
subclass IN ('university', 'college') AND
|
||||
POWER(4,zoom_level)
|
||||
-- Compute percentage of the earth's surface covered by this feature (approximately)
|
||||
-- The constant below is 111,842^2 * 180 * 180, where 111,842 is the length of one degree of latitude at the equator in meters.
|
||||
* area / (405279708033600 * COS(ST_Y(ST_Transform(geometry,4326))*PI()/180))
|
||||
-- Match features that are at least 10% of a tile at this zoom
|
||||
> 0.10
|
||||
ELSE FALSE END
|
||||
) AS poi_union
|
||||
ORDER BY "rank"
|
||||
$$ LANGUAGE SQL STABLE
|
||||
|
|
|
@ -6,9 +6,9 @@ layer:
|
|||
buffer_size: 64
|
||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI. Language-specific values are in `name:xx`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
class:
|
||||
description: |
|
||||
More general classes of POIs. If there is no more general `class` for the `subclass`
|
||||
|
@ -17,14 +17,24 @@ layer:
|
|||
and `kindergarten`. Or use the class `shop` to style all shops.
|
||||
values:
|
||||
shop:
|
||||
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist',
|
||||
'coffee', 'computer', 'convenience', 'copyshop', 'cosmetics', 'garden_centre', 'doityourself',
|
||||
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist', 'chocolate',
|
||||
'coffee', 'computer', 'convenience', 'confectionery', 'copyshop', 'cosmetics', 'garden_centre', 'doityourself',
|
||||
'erotic', 'electronics', 'fabric', 'florist', 'frozen_food', 'furniture', 'video_games', 'video',
|
||||
'general', 'gift', 'hardware', 'hearing_aids', 'hifi', 'ice_cream', 'interior_decoration',
|
||||
'jewelry', 'kiosk', 'locksmith', 'lamps', 'mall', 'massage', 'motorcycle', 'mobile_phone',
|
||||
'newsagent', 'optician', 'outdoor', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand',
|
||||
'shoes', 'sports', 'stationery', 'tailor', 'tattoo', 'ticket', 'tobacco', 'toys', 'travel_agency',
|
||||
'general', 'gift', 'hardware', 'hearing_aids', 'hifi', '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']
|
||||
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']
|
||||
town_hall:
|
||||
subclass: ['townhall', 'public_building', 'courthouse', 'community_centre']
|
||||
golf:
|
||||
|
@ -59,9 +69,9 @@ layer:
|
|||
lodging:
|
||||
subclass: ['hotel', 'motel', 'bed_and_breakfast', 'guest_house', 'hostel', 'chalet', 'alpine_hut', 'dormitory']
|
||||
ice_cream:
|
||||
subclass: ['chocolate', 'confectionery']
|
||||
subclass: ['ice_cream']
|
||||
post:
|
||||
subclass: ['post_box', 'post_office']
|
||||
subclass: ['post_box', 'post_office', 'parcel_locker']
|
||||
cafe:
|
||||
subclass: ['cafe']
|
||||
school:
|
||||
|
@ -96,6 +106,8 @@ layer:
|
|||
subclass: ['castle', 'ruins']
|
||||
atm:
|
||||
subclass: ['atm']
|
||||
fuel:
|
||||
subclass: ['fuel', 'charging_station']
|
||||
subclass:
|
||||
description: |
|
||||
Original value of either the
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
IF NOT EXISTS(SELECT 1
|
||||
FROM pg_type
|
||||
WHERE typname = 'public_transport_stop_type') THEN
|
||||
PERFORM 'public_transport_stop_type'::regtype;
|
||||
EXCEPTION
|
||||
WHEN undefined_object THEN
|
||||
CREATE TYPE public_transport_stop_type AS enum (
|
||||
'subway', 'tram_stop', 'bus_station', 'bus_stop'
|
||||
);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
|
|
|
@ -1,18 +1,28 @@
|
|||
DROP TRIGGER IF EXISTS trigger_flag ON osm_poi_point;
|
||||
DROP TRIGGER IF EXISTS trigger_refresh ON poi_point.updates;
|
||||
DROP TRIGGER IF EXISTS trigger_store ON osm_poi_point;
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS poi_point;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poi_point.osm_ids
|
||||
(
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: osm_poi_point -> osm_poi_point
|
||||
CREATE OR REPLACE FUNCTION update_osm_poi_point() RETURNS void AS
|
||||
CREATE OR REPLACE FUNCTION update_osm_poi_point(full_update bool) RETURNS void AS
|
||||
$$
|
||||
BEGIN
|
||||
UPDATE osm_poi_point
|
||||
SET subclass = 'subway'
|
||||
WHERE station = 'subway'
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
|
||||
AND station = 'subway'
|
||||
AND subclass = 'station';
|
||||
|
||||
UPDATE osm_poi_point
|
||||
SET subclass = 'halt'
|
||||
WHERE funicular = 'yes'
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
|
||||
AND funicular = 'yes'
|
||||
AND subclass = 'station';
|
||||
|
||||
-- ATM without name
|
||||
|
@ -23,19 +33,34 @@ BEGIN
|
|||
COALESCE(tags -> 'operator', tags -> 'network'),
|
||||
tags || hstore('name', COALESCE(tags -> 'operator', tags -> 'network'))
|
||||
)
|
||||
WHERE subclass = 'atm'
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
|
||||
AND subclass = 'atm'
|
||||
AND name = ''
|
||||
AND COALESCE(tags -> 'operator', tags -> 'network') IS NOT NULL;
|
||||
|
||||
-- Parcel locker without name
|
||||
-- use either brand or operator and add ref if present
|
||||
-- (using name for parcel lockers is discouraged, see osm wiki)
|
||||
UPDATE osm_poi_point
|
||||
SET (name, tags) = (
|
||||
TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))),
|
||||
tags || hstore('name', TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))))
|
||||
)
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
|
||||
AND subclass IN ('parcel_locker', 'charging_station')
|
||||
AND name = ''
|
||||
AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL;
|
||||
|
||||
UPDATE osm_poi_point
|
||||
SET tags = update_tags(tags, geometry)
|
||||
WHERE COALESCE(tags->'name:latin', tags->'name:nonlatin', tags->'name_int') IS NULL
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
|
||||
AND COALESCE(tags->'name:latin', tags->'name:nonlatin', tags->'name_int') IS NULL
|
||||
AND tags != update_tags(tags, geometry);
|
||||
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
SELECT update_osm_poi_point();
|
||||
SELECT update_osm_poi_point(TRUE);
|
||||
|
||||
-- etldoc: osm_poi_stop_rank -> osm_poi_point
|
||||
CREATE OR REPLACE FUNCTION update_osm_poi_point_agg() RETURNS void AS
|
||||
|
@ -48,7 +73,7 @@ BEGIN
|
|||
THEN 1
|
||||
END
|
||||
WHERE
|
||||
agg_stop != CASE
|
||||
agg_stop IS DISTINCT FROM CASE
|
||||
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
||||
THEN 1
|
||||
END;
|
||||
|
@ -58,15 +83,15 @@ BEGIN
|
|||
agg_stop = (
|
||||
CASE
|
||||
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
||||
AND r.rk IS NULL OR r.rk = 1
|
||||
AND (r.rk IS NULL OR r.rk = 1)
|
||||
THEN 1
|
||||
END)
|
||||
FROM osm_poi_stop_rank r
|
||||
WHERE p.osm_id = r.osm_id AND
|
||||
agg_stop != (
|
||||
agg_stop IS DISTINCT FROM (
|
||||
CASE
|
||||
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
||||
AND r.rk IS NULL OR r.rk = 1
|
||||
AND (r.rk IS NULL OR r.rk = 1)
|
||||
THEN 1
|
||||
END);
|
||||
|
||||
|
@ -79,7 +104,13 @@ SELECT update_osm_poi_point_agg();
|
|||
|
||||
-- Handle updates
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS poi_point;
|
||||
CREATE OR REPLACE FUNCTION poi_point.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
INSERT INTO poi_point.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poi_point.updates
|
||||
(
|
||||
|
@ -101,11 +132,18 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh poi_point';
|
||||
PERFORM update_osm_poi_point();
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE poi_point.osm_ids;
|
||||
ANALYZE osm_poi_point;
|
||||
|
||||
PERFORM update_osm_poi_point(FALSE);
|
||||
REFRESH MATERIALIZED VIEW osm_poi_stop_centroid;
|
||||
REFRESH MATERIALIZED VIEW osm_poi_stop_rank;
|
||||
PERFORM update_osm_poi_point_agg();
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM poi_point.osm_ids;
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM poi_point.updates;
|
||||
|
||||
RAISE LOG 'Refresh poi_point done in %', age(clock_timestamp(), t);
|
||||
|
@ -113,8 +151,14 @@ BEGIN
|
|||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_poi_point
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE poi_point.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_poi_point
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE poi_point.flag();
|
||||
|
|
|
@ -6,7 +6,7 @@ CREATE SCHEMA IF NOT EXISTS poi_polygon;
|
|||
|
||||
CREATE TABLE IF NOT EXISTS poi_polygon.osm_ids
|
||||
(
|
||||
osm_id bigint
|
||||
osm_id bigint PRIMARY KEY
|
||||
);
|
||||
|
||||
-- etldoc: osm_poi_polygon -> osm_poi_polygon
|
||||
|
@ -36,6 +36,19 @@ $$
|
|||
AND funicular = 'yes'
|
||||
AND subclass = 'station';
|
||||
|
||||
-- Parcel locker and charging_station without name
|
||||
-- use either brand or operator and add ref if present
|
||||
-- (using name for parcel lockers is discouraged, see osm wiki)
|
||||
UPDATE osm_poi_polygon
|
||||
SET (name, tags) = (
|
||||
TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))),
|
||||
tags || hstore('name', TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))))
|
||||
)
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_polygon.osm_ids))
|
||||
AND subclass IN ('parcel_locker', 'charging_station')
|
||||
AND name = ''
|
||||
AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL;
|
||||
|
||||
UPDATE osm_poi_polygon
|
||||
SET tags = update_tags(tags, geometry)
|
||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_polygon.osm_ids))
|
||||
|
@ -51,11 +64,7 @@ SELECT update_poi_polygon(true);
|
|||
CREATE OR REPLACE FUNCTION poi_polygon.store() RETURNS trigger AS
|
||||
$$
|
||||
BEGIN
|
||||
IF (tg_op = 'DELETE') THEN
|
||||
INSERT INTO poi_polygon.osm_ids VALUES (OLD.osm_id);
|
||||
ELSE
|
||||
INSERT INTO poi_polygon.osm_ids VALUES (NEW.osm_id);
|
||||
END IF;
|
||||
INSERT INTO poi_polygon.osm_ids VALUES (NEW.osm_id) ON CONFLICT (osm_id) DO NOTHING;
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
@ -80,6 +89,11 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh poi_polygon';
|
||||
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE poi_polygon.osm_ids;
|
||||
ANALYZE osm_poi_polygon;
|
||||
|
||||
PERFORM update_poi_polygon(false);
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM poi_polygon.osm_ids;
|
||||
|
@ -92,13 +106,13 @@ END;
|
|||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_store
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_poi_polygon
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE poi_polygon.store();
|
||||
|
||||
CREATE TRIGGER trigger_flag
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
AFTER INSERT OR UPDATE
|
||||
ON osm_poi_polygon
|
||||
FOR EACH STATEMENT
|
||||
EXECUTE PROCEDURE poi_polygon.flag();
|
||||
|
|
|
@ -48,7 +48,7 @@ CREATE OR REPLACE FUNCTION surface_value(surface text) RETURNS text AS
|
|||
$$
|
||||
SELECT CASE
|
||||
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'concrete', 'concrete:lanes', 'concrete:plates', 'metal',
|
||||
'paving_stones', 'sett', 'unhewn_cobblestone', 'wood') THEN 'paved'
|
||||
'paving_stones', 'sett', 'unhewn_cobblestone', 'wood', 'grade1') THEN 'paved'
|
||||
WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel',
|
||||
'gravel_turf', 'ground', 'ice', 'mud', 'pebblestone', 'salt', 'sand', 'snow', 'woodchips')
|
||||
THEN 'unpaved'
|
||||
|
@ -67,7 +67,7 @@ SELECT CASE
|
|||
'motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'raceway',
|
||||
'motorway_construction', 'trunk_construction', 'primary_construction',
|
||||
'secondary_construction', 'tertiary_construction', 'raceway_construction',
|
||||
'busway'
|
||||
'busway', 'bus_guideway'
|
||||
) THEN TRUE --includes ramps
|
||||
ELSE FALSE
|
||||
END
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 538 KiB Po Szerokość: | Wysokość: | Rozmiar: 865 KiB |
|
@ -31,6 +31,48 @@ generalized_tables:
|
|||
sql_filter: ST_IsValid(geometry)
|
||||
tolerance: ZRES13
|
||||
|
||||
# etldoc: osm_shipway_linestring_gen_z5 -> osm_shipway_linestring_gen_z4
|
||||
shipway_linestring_gen_z4:
|
||||
source: shipway_linestring_gen_z5
|
||||
sql_filter: ST_Length(geometry)>2*ZRES0
|
||||
tolerance: ZRES5
|
||||
|
||||
# etldoc: osm_shipway_linestring_gen_z6 -> osm_shipway_linestring_gen_z5
|
||||
shipway_linestring_gen_z5:
|
||||
source: shipway_linestring_gen_z6
|
||||
sql_filter: ST_Length(geometry)>ZRES0
|
||||
tolerance: ZRES6
|
||||
|
||||
# etldoc: osm_shipway_linestring_gen_z7 -> osm_shipway_linestring_gen_z6
|
||||
shipway_linestring_gen_z6:
|
||||
source: shipway_linestring_gen_z7
|
||||
sql_filter: ST_Length(geometry)>ZRES1
|
||||
tolerance: ZRES7
|
||||
|
||||
# etldoc: osm_shipway_linestring_gen_z8 -> osm_shipway_linestring_gen_z7
|
||||
shipway_linestring_gen_z7:
|
||||
source: shipway_linestring_gen_z8
|
||||
sql_filter: ST_Length(geometry)>ZRES2
|
||||
tolerance: ZRES8
|
||||
|
||||
# etldoc: osm_shipway_linestring_gen_z9 -> osm_shipway_linestring_gen_z8
|
||||
shipway_linestring_gen_z8:
|
||||
source: shipway_linestring_gen_z9
|
||||
sql_filter: ST_Length(geometry)>ZRES3
|
||||
tolerance: ZRES9
|
||||
|
||||
# etldoc: osm_shipway_linestring_gen_z10 -> osm_shipway_linestring_gen_z9
|
||||
shipway_linestring_gen_z9:
|
||||
source: shipway_linestring_gen_z10
|
||||
sql_filter: ST_Length(geometry)>ZRES4
|
||||
tolerance: ZRES10
|
||||
|
||||
# etldoc: osm_shipway_linestring_gen_z11 -> osm_shipway_linestring_gen_z10
|
||||
shipway_linestring_gen_z10:
|
||||
source: shipway_linestring_gen_z11
|
||||
sql_filter: ST_Length(geometry)>ZRES5
|
||||
tolerance: ZRES11
|
||||
|
||||
# etldoc: osm_shipway_linestring_gen_z12 -> osm_shipway_linestring_gen_z11
|
||||
shipway_linestring_gen_z11:
|
||||
source: shipway_linestring_gen_z12
|
||||
|
@ -45,7 +87,7 @@ generalized_tables:
|
|||
# etldoc: osm_highway_linestring -> osm_highway_linestring_gen_z11
|
||||
highway_linestring_gen_z11:
|
||||
source: highway_linestring
|
||||
sql_filter: (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link', 'busway') OR highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link', 'busway')) AND NOT is_area AND ST_IsValid(geometry)
|
||||
sql_filter: (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link', 'busway', 'bus_guideway') OR highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link', 'busway', 'bus_guideway')) AND NOT is_area AND ST_IsValid(geometry)
|
||||
tolerance: ZRES12
|
||||
|
||||
name_field: &name
|
||||
|
@ -60,10 +102,6 @@ name_de_field: &name_de
|
|||
name: name_de
|
||||
key: name:de
|
||||
type: string
|
||||
short_name_field: &short_name
|
||||
key: short_name
|
||||
name: short_name
|
||||
type: string
|
||||
tunnel_field: &tunnel
|
||||
key: tunnel
|
||||
name: is_tunnel
|
||||
|
@ -180,6 +218,9 @@ tables:
|
|||
- name: construction
|
||||
key: construction
|
||||
type: string
|
||||
- name: tracktype
|
||||
key: tracktype
|
||||
type: string
|
||||
- *ref
|
||||
- *network
|
||||
- *z_order
|
||||
|
@ -191,7 +232,6 @@ tables:
|
|||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
|
@ -238,6 +278,7 @@ tables:
|
|||
- track
|
||||
- raceway
|
||||
- busway
|
||||
- bus_guideway
|
||||
- construction
|
||||
public_transport:
|
||||
- platform
|
||||
|
@ -270,12 +311,10 @@ tables:
|
|||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
- *ford
|
||||
- *oneway
|
||||
- *area
|
||||
- *service
|
||||
- *usage
|
||||
|
@ -309,7 +348,6 @@ tables:
|
|||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
|
@ -348,12 +386,10 @@ tables:
|
|||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
- *ford
|
||||
- *oneway
|
||||
- *area
|
||||
- *service
|
||||
- *usage
|
||||
|
@ -447,6 +483,9 @@ tables:
|
|||
- name: colour
|
||||
key: colour
|
||||
type: string
|
||||
- name: ref_colour
|
||||
key: ref:colour
|
||||
type: string
|
||||
mapping:
|
||||
route:
|
||||
- road
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 157 KiB Po Szerokość: | Wysokość: | Rozmiar: 159 KiB |
|
@ -10,24 +10,48 @@ DROP TRIGGER IF EXISTS trigger_refresh_name ON transportation_name.updates_name;
|
|||
DO
|
||||
$$
|
||||
BEGIN
|
||||
IF NOT EXISTS(SELECT 1 FROM pg_type WHERE typname = 'route_network_type') THEN
|
||||
PERFORM 'route_network_type'::regtype;
|
||||
EXCEPTION
|
||||
WHEN undefined_object THEN
|
||||
CREATE TYPE route_network_type AS enum (
|
||||
'us-interstate', 'us-highway', 'us-state',
|
||||
'ca-transcanada',
|
||||
'gb-motorway', 'gb-trunk'
|
||||
'ca-transcanada', 'ca-provincial-arterial', 'ca-provincial',
|
||||
'gb-motorway', 'gb-trunk', 'gb-primary',
|
||||
'ie-motorway', 'ie-national', 'ie-regional',
|
||||
'e-road',
|
||||
'a-road'
|
||||
);
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
|
||||
DO
|
||||
-- Top-level national route networks that should display at the lowest zooms
|
||||
CREATE OR REPLACE FUNCTION osm_national_network(network text) RETURNS boolean AS
|
||||
$$
|
||||
BEGIN
|
||||
BEGIN
|
||||
ALTER TABLE osm_route_member
|
||||
ADD COLUMN network_type route_network_type;
|
||||
EXCEPTION
|
||||
WHEN duplicate_column THEN RAISE NOTICE 'column network_type already exists in network_type.';
|
||||
END;
|
||||
END;
|
||||
$$;
|
||||
SELECT network <> '' AND network IN (
|
||||
-- Canada
|
||||
'ca-transcanada', 'ca-provincial-arterial',
|
||||
-- United States
|
||||
'us-interstate', 'us-highway',
|
||||
-- UK
|
||||
'gb-motorway', 'gb-trunk',
|
||||
-- Ireland
|
||||
'ie-motorway', 'ie-national',
|
||||
-- Europe
|
||||
'e-road',
|
||||
-- Asia
|
||||
'a-road'
|
||||
);
|
||||
$$ LANGUAGE sql IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION create_route_hstore(network TEXT, ref TEXT, name TEXT, colour TEXT, ref_colour TEXT)
|
||||
RETURNS hstore AS $$
|
||||
SELECT CASE
|
||||
WHEN network = '' THEN hstore('')
|
||||
ELSE hstore(
|
||||
ARRAY['network', 'ref', 'name', 'colour'],
|
||||
ARRAY[network, NULLIF(ref, ''), NULLIF(name, ''), COALESCE(NULLIF(colour, ''), NULLIF(ref_colour, ''))]
|
||||
)
|
||||
END;
|
||||
$$ LANGUAGE sql IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
|
|
@ -62,7 +62,7 @@ SELECT osm_id,
|
|||
NULLIF(service, '') AS service,
|
||||
access,
|
||||
CASE WHEN toll = TRUE THEN 1 END AS toll,
|
||||
CASE WHEN highway NOT IN ('', 'motorway') AND expressway = TRUE THEN 1 END AS expressway,
|
||||
CASE WHEN highway NOT IN ('', 'motorway') AND NOT is_ramp AND expressway = TRUE THEN 1 END AS expressway,
|
||||
NULLIF(layer, 0) AS layer,
|
||||
"level",
|
||||
CASE WHEN indoor = TRUE THEN 1 END AS indoor,
|
||||
|
@ -368,7 +368,7 @@ FROM (
|
|||
foot,
|
||||
horse,
|
||||
mtb_scale,
|
||||
surface_value(surface) AS "surface",
|
||||
surface_value(COALESCE(NULLIF(surface, ''), tracktype)) AS "surface",
|
||||
hl.z_order
|
||||
FROM osm_highway_linestring hl
|
||||
LEFT OUTER JOIN osm_transportation_name_network n ON hl.osm_id = n.osm_id
|
||||
|
@ -483,7 +483,7 @@ FROM (
|
|||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
@ -518,7 +518,7 @@ FROM (
|
|||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
@ -553,7 +553,7 @@ FROM (
|
|||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
@ -589,7 +589,7 @@ FROM (
|
|||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
@ -625,7 +625,7 @@ FROM (
|
|||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
@ -659,7 +659,7 @@ FROM (
|
|||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
@ -674,6 +674,237 @@ FROM (
|
|||
WHERE zoom_level >= 13
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_shipway_linestring_gen_z4 -> layer_transportation:z4
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
NULL AS highway,
|
||||
NULL AS construction,
|
||||
NULL AS network,
|
||||
NULL AS railway,
|
||||
NULL AS aerialway,
|
||||
shipway,
|
||||
NULL AS public_transport,
|
||||
service_value(service) AS service,
|
||||
NULL::text AS access,
|
||||
NULL::boolean AS toll,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor,
|
||||
NULL AS bicycle,
|
||||
NULL AS foot,
|
||||
NULL AS horse,
|
||||
NULL AS mtb_scale,
|
||||
NULL AS surface,
|
||||
z_order
|
||||
FROM osm_shipway_linestring_gen_z4
|
||||
WHERE zoom_level = 4
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_shipway_linestring_gen_z5 -> layer_transportation:z5
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
NULL AS highway,
|
||||
NULL AS construction,
|
||||
NULL AS network,
|
||||
NULL AS railway,
|
||||
NULL AS aerialway,
|
||||
shipway,
|
||||
NULL AS public_transport,
|
||||
service_value(service) AS service,
|
||||
NULL::text AS access,
|
||||
NULL::boolean AS toll,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor,
|
||||
NULL AS bicycle,
|
||||
NULL AS foot,
|
||||
NULL AS horse,
|
||||
NULL AS mtb_scale,
|
||||
NULL AS surface,
|
||||
z_order
|
||||
FROM osm_shipway_linestring_gen_z5
|
||||
WHERE zoom_level = 5
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_shipway_linestring_gen_z6 -> layer_transportation:z6
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
NULL AS highway,
|
||||
NULL AS construction,
|
||||
NULL AS network,
|
||||
NULL AS railway,
|
||||
NULL AS aerialway,
|
||||
shipway,
|
||||
NULL AS public_transport,
|
||||
service_value(service) AS service,
|
||||
NULL::text AS access,
|
||||
NULL::boolean AS toll,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor,
|
||||
NULL AS bicycle,
|
||||
NULL AS foot,
|
||||
NULL AS horse,
|
||||
NULL AS mtb_scale,
|
||||
NULL AS surface,
|
||||
z_order
|
||||
FROM osm_shipway_linestring_gen_z6
|
||||
WHERE zoom_level = 6
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_shipway_linestring_gen_z7 -> layer_transportation:z7
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
NULL AS highway,
|
||||
NULL AS construction,
|
||||
NULL AS network,
|
||||
NULL AS railway,
|
||||
NULL AS aerialway,
|
||||
shipway,
|
||||
NULL AS public_transport,
|
||||
service_value(service) AS service,
|
||||
NULL::text AS access,
|
||||
NULL::boolean AS toll,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor,
|
||||
NULL AS bicycle,
|
||||
NULL AS foot,
|
||||
NULL AS horse,
|
||||
NULL AS mtb_scale,
|
||||
NULL AS surface,
|
||||
z_order
|
||||
FROM osm_shipway_linestring_gen_z7
|
||||
WHERE zoom_level = 7
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_shipway_linestring_gen_z8 -> layer_transportation:z8
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
NULL AS highway,
|
||||
NULL AS construction,
|
||||
NULL AS network,
|
||||
NULL AS railway,
|
||||
NULL AS aerialway,
|
||||
shipway,
|
||||
NULL AS public_transport,
|
||||
service_value(service) AS service,
|
||||
NULL::text AS access,
|
||||
NULL::boolean AS toll,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor,
|
||||
NULL AS bicycle,
|
||||
NULL AS foot,
|
||||
NULL AS horse,
|
||||
NULL AS mtb_scale,
|
||||
NULL AS surface,
|
||||
z_order
|
||||
FROM osm_shipway_linestring_gen_z8
|
||||
WHERE zoom_level = 8
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_shipway_linestring_gen_z9 -> layer_transportation:z9
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
NULL AS highway,
|
||||
NULL AS construction,
|
||||
NULL AS network,
|
||||
NULL AS railway,
|
||||
NULL AS aerialway,
|
||||
shipway,
|
||||
NULL AS public_transport,
|
||||
service_value(service) AS service,
|
||||
NULL::text AS access,
|
||||
NULL::boolean AS toll,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor,
|
||||
NULL AS bicycle,
|
||||
NULL AS foot,
|
||||
NULL AS horse,
|
||||
NULL AS mtb_scale,
|
||||
NULL AS surface,
|
||||
z_order
|
||||
FROM osm_shipway_linestring_gen_z9
|
||||
WHERE zoom_level = 9
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_shipway_linestring_gen_z10 -> layer_transportation:z10
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
NULL AS highway,
|
||||
NULL AS construction,
|
||||
NULL AS network,
|
||||
NULL AS railway,
|
||||
NULL AS aerialway,
|
||||
shipway,
|
||||
NULL AS public_transport,
|
||||
service_value(service) AS service,
|
||||
NULL::text AS access,
|
||||
NULL::boolean AS toll,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor,
|
||||
NULL AS bicycle,
|
||||
NULL AS foot,
|
||||
NULL AS horse,
|
||||
NULL AS mtb_scale,
|
||||
NULL AS surface,
|
||||
z_order
|
||||
FROM osm_shipway_linestring_gen_z10
|
||||
WHERE zoom_level = 10
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_shipway_linestring_gen_z11 -> layer_transportation:z11
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
|
@ -692,7 +923,7 @@ FROM (
|
|||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
@ -725,7 +956,7 @@ FROM (
|
|||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
@ -759,7 +990,7 @@ FROM (
|
|||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
|
|
@ -51,6 +51,10 @@ layer:
|
|||
highway: raceway
|
||||
busway:
|
||||
highway: busway
|
||||
bus_guideway:
|
||||
highway: bus_guideway
|
||||
ferry:
|
||||
highway: shipway
|
||||
motorway_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
|
@ -117,12 +121,14 @@ layer:
|
|||
- bridleway
|
||||
- corridor
|
||||
- platform
|
||||
- ferry (DEPRECATED - use class)
|
||||
network:
|
||||
description: |
|
||||
The network type derived mainly from [`network`](http://wiki.openstreetmap.org/wiki/Key:network) tag of the road.
|
||||
See more info about [`us-*`](http://wiki.openstreetmap.org/wiki/Road_signs_in_the_United_States),
|
||||
[`ca-transcanada`](https://en.wikipedia.org/wiki/Trans-Canada_Highway),
|
||||
or [`gb-*`](http://wiki.openstreetmap.org/wiki/United_Kingdom_Tagging_Guidelines#UK_roads).
|
||||
[`gb-*`](http://wiki.openstreetmap.org/wiki/United_Kingdom_Tagging_Guidelines#UK_roads),
|
||||
or [`ie-*`](http://wiki.openstreetmap.org/wiki/Ireland/Roads).
|
||||
brunnel:
|
||||
description: |
|
||||
Mark whether way is a tunnel or bridge.
|
||||
|
|
|
@ -1,118 +1,196 @@
|
|||
CREATE TABLE IF NOT EXISTS ne_10m_admin_0_bg_buffer AS
|
||||
DROP TRIGGER IF EXISTS trigger_store_transportation_highway_linestring ON osm_highway_linestring;
|
||||
|
||||
-- Create bounding windows for country-specific processing
|
||||
|
||||
-- etldoc: ne_10m_admin_0_countries -> ne_10m_admin_0_gb_buffer
|
||||
CREATE TABLE IF NOT EXISTS ne_10m_admin_0_gb_buffer AS
|
||||
SELECT ST_Buffer(geometry, 10000)
|
||||
FROM ne_10m_admin_0_countries
|
||||
WHERE iso_a2 = 'GB';
|
||||
|
||||
CREATE OR REPLACE VIEW gbr_route_members_view AS
|
||||
SELECT 0,
|
||||
osm_id,
|
||||
substring(ref FROM E'^[AM][0-9AM()]+'),
|
||||
CASE WHEN highway = 'motorway' THEN 'omt-gb-motorway' ELSE 'omt-gb-trunk' END
|
||||
FROM osm_highway_linestring
|
||||
WHERE length(ref) > 0
|
||||
AND ST_Intersects(geometry, (SELECT * FROM ne_10m_admin_0_bg_buffer))
|
||||
AND highway IN ('motorway', 'trunk')
|
||||
;
|
||||
-- Create GBR relations (so we can use it in the same way as other relations)
|
||||
DELETE
|
||||
FROM osm_route_member
|
||||
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk');
|
||||
-- etldoc: osm_highway_linestring -> osm_route_member
|
||||
INSERT INTO osm_route_member (osm_id, member, ref, network)
|
||||
SELECT *
|
||||
FROM gbr_route_members_view;
|
||||
-- etldoc: ne_10m_admin_0_countries -> ne_10m_admin_0_ie_buffer
|
||||
CREATE TABLE IF NOT EXISTS ne_10m_admin_0_ie_buffer AS
|
||||
SELECT ST_Buffer(geometry, 10000)
|
||||
FROM ne_10m_admin_0_countries
|
||||
WHERE iso_a2 = 'IE';
|
||||
|
||||
CREATE OR REPLACE FUNCTION osm_route_member_network_type(network text) RETURNS route_network_type AS
|
||||
-- Assign pseudo-networks based highway classification
|
||||
-- etldoc: osm_highway_linestring -> gbr_route_members_view
|
||||
-- etldoc: ne_10m_admin_0_gb_buffer -> gbr_route_members_view
|
||||
CREATE OR REPLACE VIEW gbr_route_members_view AS
|
||||
SELECT osm_id AS member,
|
||||
substring(ref FROM E'^[ABM][0-9ABM()]+') AS ref,
|
||||
-- See https://wiki.openstreetmap.org/wiki/Roads_in_the_United_Kingdom
|
||||
CASE WHEN highway = 'motorway' THEN 'omt-gb-motorway'
|
||||
WHEN highway = 'trunk' THEN 'omt-gb-trunk'
|
||||
WHEN highway IN ('primary','secondary') THEN 'omt-gb-primary' END AS network
|
||||
FROM osm_highway_linestring
|
||||
WHERE length(ref) > 1
|
||||
AND ST_Intersects(geometry, (SELECT * FROM ne_10m_admin_0_gb_buffer))
|
||||
AND highway IN ('motorway', 'trunk', 'primary', 'secondary')
|
||||
;
|
||||
|
||||
-- etldoc: osm_highway_linestring -> ire_route_members_view
|
||||
-- etldoc: ne_10m_admin_0_ie_buffer -> ire_route_members_view
|
||||
CREATE OR REPLACE VIEW ire_route_members_view AS
|
||||
SELECT osm_id AS member,
|
||||
substring(ref FROM E'^[MNRL][0-9]+') AS ref,
|
||||
-- See https://wiki.openstreetmap.org/wiki/Ireland/Roads
|
||||
CASE WHEN highway = 'motorway' THEN 'omt-ie-motorway'
|
||||
WHEN highway IN ('trunk','primary') THEN 'omt-ie-national'
|
||||
ELSE 'omt-ie-regional' END AS network
|
||||
FROM osm_highway_linestring
|
||||
WHERE length(ref) > 1
|
||||
AND ST_Intersects(geometry, (SELECT * FROM ne_10m_admin_0_ie_buffer))
|
||||
AND highway IN ('motorway', 'trunk', 'primary', 'secondary', 'unclassified')
|
||||
;
|
||||
|
||||
CREATE OR REPLACE FUNCTION osm_route_member_network_type(network text, ref text) RETURNS route_network_type AS
|
||||
$$
|
||||
SELECT CASE
|
||||
-- https://wiki.openstreetmap.org/wiki/United_States_roads_tagging
|
||||
WHEN network = 'US:I' THEN 'us-interstate'::route_network_type
|
||||
WHEN network = 'US:US' THEN 'us-highway'::route_network_type
|
||||
WHEN network LIKE 'US:__' THEN 'us-state'::route_network_type
|
||||
-- https://en.wikipedia.org/wiki/Trans-Canada_Highway
|
||||
WHEN network LIKE 'CA:transcanada%' THEN 'ca-transcanada'::route_network_type
|
||||
WHEN network = 'CA:QC:A' THEN 'ca-provincial-arterial'::route_network_type
|
||||
WHEN network = 'CA:ON:primary' THEN
|
||||
CASE
|
||||
WHEN ref LIKE '4__' THEN 'ca-provincial-arterial'::route_network_type
|
||||
WHEN ref = 'QEW' THEN 'ca-provincial-arterial'::route_network_type
|
||||
ELSE 'ca-provincial'::route_network_type
|
||||
END
|
||||
WHEN network = 'CA:MB:PTH' AND ref = '75' THEN 'ca-provincial-arterial'::route_network_type
|
||||
WHEN network = 'CA:AB:primary' AND ref IN ('2','3','4') THEN 'ca-provincial-arterial'::route_network_type
|
||||
WHEN network = 'CA:BC' AND ref IN ('3','5','99') THEN 'ca-provincial-arterial'::route_network_type
|
||||
WHEN network LIKE 'CA:__' OR network LIKE 'CA:__:%' THEN 'ca-provincial'::route_network_type
|
||||
WHEN network = 'omt-gb-motorway' THEN 'gb-motorway'::route_network_type
|
||||
WHEN network = 'omt-gb-trunk' THEN 'gb-trunk'::route_network_type
|
||||
END;
|
||||
WHEN network = 'omt-gb-primary' THEN 'gb-primary'::route_network_type
|
||||
WHEN network = 'omt-ie-motorway' THEN 'ie-motorway'::route_network_type
|
||||
WHEN network = 'omt-ie-national' THEN 'ie-national'::route_network_type
|
||||
WHEN network = 'omt-ie-regional' THEN 'ie-regional'::route_network_type
|
||||
END;
|
||||
$$ LANGUAGE sql IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
-- etldoc: osm_route_member -> osm_route_member
|
||||
-- see http://wiki.openstreetmap.org/wiki/Relation:route#Road_routes
|
||||
UPDATE osm_route_member
|
||||
SET network_type = osm_route_member_network_type(network)
|
||||
WHERE network != ''
|
||||
AND network_type IS DISTINCT FROM osm_route_member_network_type(network)
|
||||
;
|
||||
CREATE TABLE IF NOT EXISTS transportation_route_member_coalesced
|
||||
(
|
||||
member bigint,
|
||||
network varchar,
|
||||
ref varchar,
|
||||
osm_id bigint not null,
|
||||
role varchar,
|
||||
type smallint,
|
||||
name varchar,
|
||||
osmc_symbol varchar,
|
||||
colour varchar,
|
||||
ref_colour varchar,
|
||||
network_type route_network_type,
|
||||
concurrency_index integer,
|
||||
rank integer,
|
||||
PRIMARY KEY (member, network, ref)
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION update_osm_route_member() RETURNS void AS
|
||||
CREATE OR REPLACE FUNCTION update_osm_route_member(full_update bool) RETURNS void AS
|
||||
$$
|
||||
BEGIN
|
||||
-- Analyze tracking and source tables before performing update
|
||||
ANALYZE transportation_name.network_changes;
|
||||
ANALYZE osm_highway_linestring;
|
||||
ANALYZE osm_route_member;
|
||||
|
||||
DELETE
|
||||
FROM osm_route_member AS r
|
||||
USING
|
||||
transportation_name.network_changes AS c
|
||||
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk')
|
||||
AND r.osm_id = c.osm_id;
|
||||
FROM transportation_route_member_coalesced
|
||||
USING transportation_name.network_changes c
|
||||
WHERE c.is_old IS TRUE AND transportation_route_member_coalesced.member = c.osm_id;
|
||||
|
||||
INSERT INTO osm_route_member (osm_id, member, ref, network)
|
||||
SELECT r.*
|
||||
FROM gbr_route_members_view AS r
|
||||
JOIN transportation_name.network_changes AS c ON
|
||||
r.osm_id = c.osm_id;
|
||||
|
||||
INSERT INTO osm_route_member (id, osm_id, network_type, concurrency_index, rank)
|
||||
-- etldoc: osm_route_member -> transportation_route_member_coalesced
|
||||
INSERT INTO transportation_route_member_coalesced
|
||||
SELECT
|
||||
id,
|
||||
osm_id,
|
||||
osm_route_member_network_type(network) AS network_type,
|
||||
DENSE_RANK() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index,
|
||||
osm_route_member_filtered.*,
|
||||
osm_route_member_network_type(network, ref) AS network_type,
|
||||
DENSE_RANK() OVER (
|
||||
PARTITION BY member
|
||||
ORDER BY osm_route_member_network_type(network, ref), network, LENGTH(ref), ref
|
||||
) AS concurrency_index,
|
||||
CASE
|
||||
WHEN network IN ('iwn', 'nwn', 'rwn') THEN 1
|
||||
WHEN network = 'lwn' THEN 2
|
||||
WHEN osmc_symbol || colour <> '' THEN 2
|
||||
END AS rank
|
||||
FROM osm_route_member rm
|
||||
WHERE rm.member IN
|
||||
(SELECT DISTINCT osm_id FROM transportation_name.network_changes)
|
||||
ON CONFLICT (id, osm_id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index,
|
||||
rank = EXCLUDED.rank,
|
||||
network_type = EXCLUDED.network_type;
|
||||
FROM (
|
||||
-- etldoc: osm_route_member -> osm_route_member
|
||||
-- etldoc: gbr_route_members_view -> osm_route_member
|
||||
-- etldoc: ire_route_members_view -> osm_route_member
|
||||
-- see http://wiki.openstreetmap.org/wiki/Relation:route#Road_routes
|
||||
SELECT DISTINCT ON (member, COALESCE(rel.network, ''), COALESCE(rel.ref, ''))
|
||||
rel.member,
|
||||
COALESCE(NULLIF(rel.network,''), gb_way.network, ir_way.network, '') AS network,
|
||||
COALESCE(rel.ref, '') AS ref,
|
||||
osm_id,
|
||||
role,
|
||||
type,
|
||||
name,
|
||||
osmc_symbol,
|
||||
colour,
|
||||
ref_colour
|
||||
FROM osm_route_member rel
|
||||
LEFT JOIN gbr_route_members_view gb_way ON (gb_way.member=rel.member)
|
||||
LEFT JOIN ire_route_members_view ir_way ON (ir_way.member=rel.member)
|
||||
WHERE full_update OR EXISTS(
|
||||
SELECT NULL
|
||||
FROM transportation_name.network_changes c
|
||||
WHERE c.is_old IS FALSE AND c.osm_id = rel.member
|
||||
)
|
||||
) osm_route_member_filtered
|
||||
ON CONFLICT (member, network, ref) DO UPDATE SET osm_id = EXCLUDED.osm_id, role = EXCLUDED.role,
|
||||
type = EXCLUDED.type, name = EXCLUDED.name,
|
||||
osmc_symbol = EXCLUDED.osmc_symbol, colour = EXCLUDED.colour, ref_colour = EXCLUDED.ref_colour,
|
||||
concurrency_index = EXCLUDED.concurrency_index,
|
||||
rank = EXCLUDED.rank;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_route_member_network_idx ON osm_route_member ("network");
|
||||
CREATE INDEX IF NOT EXISTS osm_route_member_member_idx ON osm_route_member ("member");
|
||||
CREATE INDEX IF NOT EXISTS osm_route_member_name_idx ON osm_route_member ("name");
|
||||
CREATE INDEX IF NOT EXISTS osm_route_member_ref_idx ON osm_route_member ("ref");
|
||||
-- Indexes which can be utilized during full-update for queries originating from update_osm_route_member() function
|
||||
CREATE INDEX IF NOT EXISTS osm_route_member_member_network_ref_idx
|
||||
ON osm_route_member (member, COALESCE(network, ''), COALESCE(ref, ''));
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_route_member_network_type_idx ON osm_route_member ("network_type");
|
||||
-- Analyze created index
|
||||
ANALYZE osm_route_member;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_highway_linestring_osm_id_idx ON osm_highway_linestring ("osm_id");
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS osm_highway_linestring_gen_z11_osm_id_idx ON osm_highway_linestring_gen_z11 ("osm_id");
|
||||
-- Ensure transportation_name.network_changes table exists since it is required by update_osm_route_member
|
||||
CREATE SCHEMA IF NOT EXISTS transportation_name;
|
||||
CREATE TABLE IF NOT EXISTS transportation_name.network_changes
|
||||
(
|
||||
is_old bool,
|
||||
osm_id bigint,
|
||||
PRIMARY KEY (is_old, osm_id)
|
||||
);
|
||||
|
||||
ALTER TABLE osm_route_member ADD COLUMN IF NOT EXISTS concurrency_index int,
|
||||
ADD COLUMN IF NOT EXISTS rank int;
|
||||
-- Fill transportation_route_member_coalesced table
|
||||
TRUNCATE transportation_route_member_coalesced;
|
||||
SELECT update_osm_route_member(TRUE);
|
||||
|
||||
-- One-time load of concurrency indexes; updates occur via trigger
|
||||
INSERT INTO osm_route_member (id, osm_id, concurrency_index, rank)
|
||||
SELECT
|
||||
id,
|
||||
osm_id,
|
||||
DENSE_RANK() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index,
|
||||
CASE
|
||||
WHEN network IN ('iwn', 'nwn', 'rwn') THEN 1
|
||||
WHEN network = 'lwn' THEN 2
|
||||
WHEN osmc_symbol || colour <> '' THEN 2
|
||||
END AS rank
|
||||
FROM osm_route_member
|
||||
ON CONFLICT (id, osm_id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index, rank = EXCLUDED.rank;
|
||||
-- Index for queries against transportation_route_member_coalesced during transportation-name-network updates
|
||||
CREATE INDEX IF NOT EXISTS transportation_route_member_member_idx ON
|
||||
transportation_route_member_coalesced ("member", "concurrency_index");
|
||||
|
||||
-- Analyze populated table with indexes
|
||||
ANALYZE transportation_route_member_coalesced;
|
||||
|
||||
-- Ensure OSM-ID index exists on osm_highway_linestring
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS osm_highway_linestring_osm_id_idx ON osm_highway_linestring ("osm_id");
|
||||
|
||||
-- etldoc: osm_route_member -> osm_highway_linestring
|
||||
UPDATE osm_highway_linestring hl
|
||||
SET network = rm.network_type
|
||||
FROM osm_route_member rm
|
||||
FROM transportation_route_member_coalesced rm
|
||||
WHERE hl.osm_id=rm.member AND rm.concurrency_index=1;
|
||||
|
||||
-- etldoc: osm_route_member -> osm_highway_linestring_gen_z11
|
||||
UPDATE osm_highway_linestring_gen_z11 hl
|
||||
SET network = rm.network_type
|
||||
FROM osm_route_member rm
|
||||
FROM transportation_route_member_coalesced rm
|
||||
WHERE hl.osm_id=rm.member AND rm.concurrency_index=1;
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 283 KiB Po Szerokość: | Wysokość: | Rozmiar: 329 KiB |
|
@ -1,52 +1,46 @@
|
|||
CREATE OR REPLACE FUNCTION highway_to_val(hwy_class varchar)
|
||||
RETURNS int
|
||||
IMMUTABLE
|
||||
LANGUAGE plpgsql
|
||||
LANGUAGE sql
|
||||
AS $$
|
||||
BEGIN
|
||||
CASE hwy_class
|
||||
WHEN 'motorway' THEN RETURN 6;
|
||||
WHEN 'trunk' THEN RETURN 5;
|
||||
WHEN 'primary' THEN RETURN 4;
|
||||
WHEN 'secondary' THEN RETURN 3;
|
||||
WHEN 'tertiary' THEN RETURN 2;
|
||||
WHEN 'unclassified' THEN RETURN 1;
|
||||
else RETURN 0;
|
||||
END CASE;
|
||||
END;
|
||||
SELECT CASE hwy_class
|
||||
WHEN 'motorway' THEN 6
|
||||
WHEN 'trunk' THEN 5
|
||||
WHEN 'primary' THEN 4
|
||||
WHEN 'secondary' THEN 3
|
||||
WHEN 'tertiary' THEN 2
|
||||
WHEN 'unclassified' THEN 1
|
||||
ELSE 0
|
||||
END;
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE FUNCTION val_to_highway(hwy_val int)
|
||||
RETURNS varchar
|
||||
IMMUTABLE
|
||||
LANGUAGE plpgsql
|
||||
LANGUAGE sql
|
||||
AS $$
|
||||
BEGIN
|
||||
CASE hwy_val
|
||||
WHEN 6 THEN RETURN 'motorway';
|
||||
WHEN 5 THEN RETURN 'trunk';
|
||||
WHEN 4 THEN RETURN 'primary';
|
||||
WHEN 3 THEN RETURN 'secondary';
|
||||
WHEN 2 THEN RETURN 'tertiary';
|
||||
WHEN 1 THEN RETURN 'unclassified';
|
||||
else RETURN null;
|
||||
END CASE;
|
||||
END;
|
||||
SELECT CASE hwy_val
|
||||
WHEN 6 THEN 'motorway'
|
||||
WHEN 5 THEN 'trunk'
|
||||
WHEN 4 THEN 'primary'
|
||||
WHEN 3 THEN 'secondary'
|
||||
WHEN 2 THEN 'tertiary'
|
||||
WHEN 1 THEN 'unclassified'
|
||||
ELSE null
|
||||
END;
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE FUNCTION highest_hwy_sfunc(agg_state varchar, hwy_class varchar)
|
||||
RETURNS varchar
|
||||
IMMUTABLE
|
||||
LANGUAGE plpgsql
|
||||
LANGUAGE sql
|
||||
AS $$
|
||||
BEGIN
|
||||
RETURN val_to_highway(
|
||||
SELECT val_to_highway(
|
||||
GREATEST(
|
||||
highway_to_val(agg_state),
|
||||
highway_to_val(hwy_class)
|
||||
)
|
||||
);
|
||||
END;
|
||||
$$;
|
||||
|
||||
DROP AGGREGATE IF EXISTS highest_highway (varchar);
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 157 KiB Po Szerokość: | Wysokość: | Rozmiar: 159 KiB |
|
@ -0,0 +1,406 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "ferry_label",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "transportation_name",
|
||||
"minzoom": 14,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": 10,
|
||||
"text-field": "{name}",
|
||||
"text-anchor": "center",
|
||||
"text-offset": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"symbol-placement": "line"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#6666ff",
|
||||
"text-halo-blur": 1,
|
||||
"text-halo-color": "rgba(255, 255, 255, 0.34)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"subclass",
|
||||
"ferry"
|
||||
]
|
||||
],
|
||||
"order": 184
|
||||
},
|
||||
{
|
||||
"id": "road_label",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "transportation_name",
|
||||
"minzoom": 14,
|
||||
"layout": {
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
14,
|
||||
9
|
||||
],
|
||||
[
|
||||
18,
|
||||
13
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-field": "{name}",
|
||||
"text-anchor": "center",
|
||||
"text-offset": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"symbol-placement": "line"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#000000",
|
||||
"text-halo-color": "rgba(255, 255, 255, 0.97)",
|
||||
"text-halo-width": 1
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"!=",
|
||||
"subclass",
|
||||
"ferry"
|
||||
]
|
||||
],
|
||||
"order": 185
|
||||
},
|
||||
{
|
||||
"id": "highway-shield-tertiary",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "transportation_name",
|
||||
"minzoom": 9,
|
||||
"layout": {
|
||||
"icon-size": 1,
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
9,
|
||||
10
|
||||
],
|
||||
[
|
||||
15,
|
||||
11
|
||||
],
|
||||
[
|
||||
17,
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": "road_tertiary",
|
||||
"text-field": "{ref}",
|
||||
"visibility": "visible",
|
||||
"icon-anchor": "center",
|
||||
"icon-padding": 2,
|
||||
"icon-text-fit": "both",
|
||||
"symbol-spacing": 560,
|
||||
"symbol-placement": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
10,
|
||||
"point"
|
||||
],
|
||||
[
|
||||
11,
|
||||
"line"
|
||||
]
|
||||
]
|
||||
},
|
||||
"symbol-avoid-edges": true,
|
||||
"icon-text-fit-padding": [
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"icon-rotation-alignment": "viewport",
|
||||
"text-rotation-alignment": "viewport"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#3b3b3b"
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"$type",
|
||||
"LineString"
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"tertiary"
|
||||
],
|
||||
[
|
||||
"has",
|
||||
"ref"
|
||||
]
|
||||
],
|
||||
"order": 186
|
||||
},
|
||||
{
|
||||
"id": "highway-shield-secondary",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "transportation_name",
|
||||
"minzoom": 9,
|
||||
"layout": {
|
||||
"icon-size": 1,
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
9,
|
||||
10
|
||||
],
|
||||
[
|
||||
15,
|
||||
11
|
||||
],
|
||||
[
|
||||
17,
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": "road_secondary",
|
||||
"text-field": "{ref}",
|
||||
"visibility": "visible",
|
||||
"icon-anchor": "center",
|
||||
"icon-padding": 2,
|
||||
"icon-text-fit": "both",
|
||||
"symbol-spacing": 560,
|
||||
"symbol-placement": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
10,
|
||||
"point"
|
||||
],
|
||||
[
|
||||
11,
|
||||
"line"
|
||||
]
|
||||
]
|
||||
},
|
||||
"symbol-avoid-edges": true,
|
||||
"icon-text-fit-padding": [
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"icon-rotation-alignment": "viewport",
|
||||
"text-rotation-alignment": "viewport"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#323b00"
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"$type",
|
||||
"LineString"
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"secondary"
|
||||
],
|
||||
[
|
||||
"has",
|
||||
"ref"
|
||||
]
|
||||
],
|
||||
"order": 187
|
||||
},
|
||||
{
|
||||
"id": "highway-shield-primary",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "transportation_name",
|
||||
"minzoom": 9,
|
||||
"layout": {
|
||||
"icon-size": 1,
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
9,
|
||||
10
|
||||
],
|
||||
[
|
||||
15,
|
||||
11
|
||||
],
|
||||
[
|
||||
17,
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": "road_primary",
|
||||
"text-field": "{ref}",
|
||||
"visibility": "visible",
|
||||
"icon-anchor": "center",
|
||||
"icon-padding": 2,
|
||||
"icon-text-fit": "both",
|
||||
"symbol-spacing": 560,
|
||||
"symbol-placement": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
10,
|
||||
"point"
|
||||
],
|
||||
[
|
||||
11,
|
||||
"line"
|
||||
]
|
||||
]
|
||||
},
|
||||
"symbol-avoid-edges": true,
|
||||
"icon-text-fit-padding": [
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"icon-rotation-alignment": "viewport",
|
||||
"text-rotation-alignment": "viewport"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#4c2e00"
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"$type",
|
||||
"LineString"
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"primary"
|
||||
],
|
||||
[
|
||||
"has",
|
||||
"ref"
|
||||
]
|
||||
],
|
||||
"order": 188
|
||||
},
|
||||
{
|
||||
"id": "highway-shield-motorway",
|
||||
"type": "symbol",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "transportation_name",
|
||||
"minzoom": 9,
|
||||
"layout": {
|
||||
"icon-size": 1,
|
||||
"text-font": [
|
||||
"Noto Sans Regular"
|
||||
],
|
||||
"text-size": {
|
||||
"stops": [
|
||||
[
|
||||
9,
|
||||
10
|
||||
],
|
||||
[
|
||||
15,
|
||||
11
|
||||
],
|
||||
[
|
||||
17,
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
"icon-image": "road_motorway",
|
||||
"text-field": "{ref}",
|
||||
"visibility": "visible",
|
||||
"icon-anchor": "center",
|
||||
"icon-padding": 2,
|
||||
"icon-text-fit": "both",
|
||||
"text-optional": false,
|
||||
"symbol-spacing": 760,
|
||||
"text-max-width": 10,
|
||||
"symbol-placement": {
|
||||
"base": 1,
|
||||
"stops": [
|
||||
[
|
||||
10,
|
||||
"point"
|
||||
],
|
||||
[
|
||||
11,
|
||||
"line"
|
||||
]
|
||||
]
|
||||
},
|
||||
"text-keep-upright": true,
|
||||
"symbol-avoid-edges": true,
|
||||
"icon-text-fit-padding": [
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"icon-rotation-alignment": "viewport",
|
||||
"text-rotation-alignment": "viewport"
|
||||
},
|
||||
"paint": {
|
||||
"text-color": "#620728"
|
||||
},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"$type",
|
||||
"LineString"
|
||||
],
|
||||
[
|
||||
"==",
|
||||
"class",
|
||||
"motorway"
|
||||
],
|
||||
[
|
||||
"has",
|
||||
"ref"
|
||||
]
|
||||
],
|
||||
"order": 189
|
||||
}
|
||||
]
|
||||
}
|
|
@ -4,26 +4,44 @@
|
|||
CREATE OR REPLACE FUNCTION layer_transportation_name(bbox geometry, zoom_level integer)
|
||||
RETURNS TABLE
|
||||
(
|
||||
geometry geometry,
|
||||
name text,
|
||||
name_en text,
|
||||
name_de text,
|
||||
tags hstore,
|
||||
ref text,
|
||||
ref_length int,
|
||||
network text,
|
||||
route_1 text,
|
||||
route_2 text,
|
||||
route_3 text,
|
||||
route_4 text,
|
||||
route_5 text,
|
||||
route_6 text,
|
||||
class text,
|
||||
subclass text,
|
||||
brunnel text,
|
||||
layer int,
|
||||
level int,
|
||||
indoor int
|
||||
geometry geometry,
|
||||
name text,
|
||||
name_en text,
|
||||
name_de text,
|
||||
tags hstore,
|
||||
ref text,
|
||||
ref_length int,
|
||||
network text,
|
||||
route_1_network text,
|
||||
route_1_ref text,
|
||||
route_1_name text,
|
||||
route_1_colour text,
|
||||
route_2_network text,
|
||||
route_2_ref text,
|
||||
route_2_name text,
|
||||
route_2_colour text,
|
||||
route_3_network text,
|
||||
route_3_ref text,
|
||||
route_3_name text,
|
||||
route_3_colour text,
|
||||
route_4_network text,
|
||||
route_4_ref text,
|
||||
route_4_name text,
|
||||
route_4_colour text,
|
||||
route_5_network text,
|
||||
route_5_ref text,
|
||||
route_5_name text,
|
||||
route_5_colour text,
|
||||
route_6_network text,
|
||||
route_6_ref text,
|
||||
route_6_name text,
|
||||
route_6_colour text,
|
||||
class text,
|
||||
subclass text,
|
||||
brunnel text,
|
||||
layer int,
|
||||
level int,
|
||||
indoor int
|
||||
)
|
||||
AS
|
||||
$$
|
||||
|
@ -40,21 +58,62 @@ SELECT geometry,
|
|||
WHEN length(coalesce(ref, '')) > 0
|
||||
THEN 'road'
|
||||
END AS network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
route_1->'network' AS route_1_network,
|
||||
route_1->'ref' AS route_1_ref,
|
||||
route_1->'name' AS route_1_name,
|
||||
route_1->'colour' AS route_1_colour,
|
||||
|
||||
route_2->'network' AS route_2_network,
|
||||
route_2->'ref' AS route_2_ref,
|
||||
route_2->'name' AS route_2_name,
|
||||
route_2->'colour' AS route_2_colour,
|
||||
|
||||
route_3->'network' AS route_3_network,
|
||||
route_3->'ref' AS route_3_ref,
|
||||
route_3->'name' AS route_3_name,
|
||||
route_3->'colour' AS route_3_colour,
|
||||
|
||||
route_4->'network' AS route_4_network,
|
||||
route_4->'ref' AS route_4_ref,
|
||||
route_4->'name' AS route_4_name,
|
||||
route_4->'colour' AS route_4_colour,
|
||||
|
||||
route_5->'network' AS route_5_network,
|
||||
route_5->'ref' AS route_5_ref,
|
||||
route_5->'name' AS route_5_name,
|
||||
route_5->'colour' AS route_5_colour,
|
||||
|
||||
route_6->'network' AS route_6_network,
|
||||
route_6->'ref' AS route_6_ref,
|
||||
route_6->'name' AS route_6_name,
|
||||
route_6->'colour' AS route_6_colour,
|
||||
highway_class(highway, '', subclass) AS class,
|
||||
CASE
|
||||
WHEN highway IS NOT NULL AND highway_class(highway, '', subclass) = 'path'
|
||||
THEN highway
|
||||
ELSE subclass
|
||||
END AS subclass,
|
||||
brunnel,
|
||||
NULLIF(brunnel, '') AS brunnel,
|
||||
NULLIF(layer, 0) AS layer,
|
||||
"level",
|
||||
CASE WHEN indoor = TRUE THEN 1 END AS indoor
|
||||
FROM (
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen4 -> layer_transportation_name:z6
|
||||
SELECT *,
|
||||
SELECT geometry,
|
||||
tags,
|
||||
ref,
|
||||
highway,
|
||||
subclass,
|
||||
brunnel,
|
||||
network,
|
||||
route_1,
|
||||
route_2,
|
||||
route_3,
|
||||
route_4,
|
||||
route_5,
|
||||
route_6,
|
||||
z_order,
|
||||
NULL::int AS layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor
|
||||
|
@ -63,32 +122,71 @@ FROM (
|
|||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen3 -> layer_transportation_name:z7
|
||||
SELECT *,
|
||||
SELECT geometry,
|
||||
tags,
|
||||
ref,
|
||||
highway,
|
||||
subclass,
|
||||
brunnel,
|
||||
network,
|
||||
route_1,
|
||||
route_2,
|
||||
route_3,
|
||||
route_4,
|
||||
route_5,
|
||||
route_6,
|
||||
z_order,
|
||||
NULL::int AS layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor
|
||||
FROM osm_transportation_name_linestring_gen3
|
||||
WHERE zoom_level = 7
|
||||
WHERE ST_Length(geometry) > 20000 AND zoom_level = 7
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen2 -> layer_transportation_name:z8
|
||||
SELECT *,
|
||||
SELECT geometry,
|
||||
tags,
|
||||
ref,
|
||||
highway,
|
||||
subclass,
|
||||
brunnel,
|
||||
network,
|
||||
route_1,
|
||||
route_2,
|
||||
route_3,
|
||||
route_4,
|
||||
route_5,
|
||||
route_6,
|
||||
z_order,
|
||||
NULL::int AS layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor
|
||||
FROM osm_transportation_name_linestring_gen2
|
||||
WHERE zoom_level = 8
|
||||
WHERE ST_Length(geometry) > 14000 AND zoom_level = 8
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z9
|
||||
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z10
|
||||
-- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z11
|
||||
SELECT *,
|
||||
SELECT geometry,
|
||||
tags,
|
||||
ref,
|
||||
highway,
|
||||
subclass,
|
||||
brunnel,
|
||||
network,
|
||||
route_1,
|
||||
route_2,
|
||||
route_3,
|
||||
route_4,
|
||||
route_5,
|
||||
route_6,
|
||||
z_order,
|
||||
NULL::int AS layer,
|
||||
NULL::int AS level,
|
||||
NULL::boolean AS indoor
|
||||
FROM osm_transportation_name_linestring_gen1
|
||||
WHERE zoom_level BETWEEN 9 AND 11
|
||||
WHERE ST_Length(geometry) > 8000 / POWER(2, zoom_level - 9) AND zoom_level BETWEEN 9 AND 11
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z12
|
||||
|
@ -106,7 +204,7 @@ FROM (
|
|||
indoor
|
||||
FROM osm_transportation_name_linestring
|
||||
WHERE zoom_level = 12
|
||||
AND LineLabel(zoom_level, COALESCE(tags->'name', ref), geometry)
|
||||
AND LineLabel(zoom_level, COALESCE(ref, tags->'name'), geometry)
|
||||
AND NOT highway_is_link(highway)
|
||||
AND
|
||||
CASE WHEN highway_class(highway, NULL::text, NULL::text) NOT IN ('path', 'minor') THEN TRUE
|
||||
|
@ -130,7 +228,7 @@ FROM (
|
|||
indoor
|
||||
FROM osm_transportation_name_linestring
|
||||
WHERE zoom_level = 13
|
||||
AND LineLabel(zoom_level, COALESCE(tags->'name', ref), geometry)
|
||||
AND LineLabel(zoom_level, COALESCE(ref, tags->'name'), geometry)
|
||||
AND
|
||||
CASE WHEN highway <> 'path' THEN TRUE
|
||||
WHEN highway = 'path' AND (
|
||||
|
@ -173,12 +271,12 @@ FROM (
|
|||
'junction'::text AS subclass,
|
||||
NULL AS brunnel,
|
||||
NULL AS network,
|
||||
NULL::text AS route_1,
|
||||
NULL::text AS route_2,
|
||||
NULL::text AS route_3,
|
||||
NULL::text AS route_4,
|
||||
NULL::text AS route_5,
|
||||
NULL::text AS route_6,
|
||||
NULL::hstore AS route_1,
|
||||
NULL::hstore AS route_2,
|
||||
NULL::hstore AS route_3,
|
||||
NULL::hstore AS route_4,
|
||||
NULL::hstore AS route_5,
|
||||
NULL::hstore AS route_6,
|
||||
z_order,
|
||||
layer,
|
||||
NULL::int AS level,
|
||||
|
|
|
@ -13,8 +13,8 @@ layer:
|
|||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||
fields:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Highways#Names_and_references) value of the highway.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
name_en: English name `name:en` if available, otherwise `name`. This is deprecated and will be removed in a future release in favor of `name:en`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`. This is deprecated and will be removed in a future release in favor of `name:de`.
|
||||
ref: The OSM [`ref`](http://wiki.openstreetmap.org/wiki/Key:ref) tag of the motorway or its network.
|
||||
ref_length: Length of the `ref` field. Useful for having a shield icon as background for labeling motorways.
|
||||
network:
|
||||
|
@ -28,8 +28,14 @@ layer:
|
|||
- us-highway
|
||||
- us-state
|
||||
- ca-transcanada
|
||||
- ca-provincial-arterial
|
||||
- ca-provincial
|
||||
- gb-motorway
|
||||
- gb-trunk
|
||||
- gb-primary
|
||||
- ie-motorway
|
||||
- ie-national
|
||||
- ie-regional
|
||||
- road (default)
|
||||
class:
|
||||
description: |
|
||||
|
@ -95,16 +101,34 @@ layer:
|
|||
value of [`indoor`](http://wiki.openstreetmap.org/wiki/Key:indoor) tag.
|
||||
values:
|
||||
- 1
|
||||
route_1: 1st route concurrency.
|
||||
route_2: 2nd route concurrency.
|
||||
route_3: 3rd route concurrency.
|
||||
route_4: 4th route concurrency.
|
||||
route_5: 5th route concurrency.
|
||||
route_6: 6th route concurrency.
|
||||
route_1_network: 1st route concurrency network.
|
||||
route_1_ref: 1st route concurrency ref.
|
||||
route_1_name: 1st route concurrency name.
|
||||
route_1_colour: 1st route concurrency colour.
|
||||
route_2_network: 2nd route concurrency network.
|
||||
route_2_ref: 2nd route concurrency ref.
|
||||
route_2_name: 2nd route concurrency name.
|
||||
route_2_colour: 2nd route concurrency colour.
|
||||
route_3_network: 3rd route concurrency network.
|
||||
route_3_ref: 3rd route concurrency ref.
|
||||
route_3_name: 3rd route concurrency name.
|
||||
route_3_colour: 3rd route concurrency colour.
|
||||
route_4_network: 4th route concurrency network.
|
||||
route_4_ref: 4th route concurrency ref.
|
||||
route_4_name: 4th route concurrency name.
|
||||
route_4_colour: 4th route concurrency colour.
|
||||
route_5_network: 5th route concurrency network.
|
||||
route_5_ref: 5th route concurrency ref.
|
||||
route_5_name: 5th route concurrency name.
|
||||
route_5_colour: 5th route concurrency colour.
|
||||
route_6_network: 6th route concurrency network.
|
||||
route_6_ref: 6th route concurrency ref.
|
||||
route_6_name: 6th route concurrency name.
|
||||
route_6_colour: 6th route concurrency colour.
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
srid: 900913
|
||||
query: (SELECT geometry, name, name_en, name_de, {name_languages}, ref, ref_length, network::text, class::text, subclass, brunnel, layer, level, indoor, route_1, route_2, route_3, route_4, route_5, route_6 FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
|
||||
query: (SELECT geometry, name, name_en, name_de, {name_languages}, ref, ref_length, network::text, class::text, subclass, brunnel, layer, level, indoor, route_1_network, route_1_ref, route_1_name, route_1_colour, route_2_network, route_2_ref, route_2_name, route_2_colour, route_3_network, route_3_ref, route_3_name, route_3_colour, route_4_network, route_4_ref, route_4_name, route_4_colour, route_5_network, route_5_ref, route_5_name, route_5_colour, route_6_network, route_6_ref, route_6_name, route_6_colour FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./highway_classification.sql
|
||||
- ./update_transportation_name.sql
|
||||
|
|
|
@ -66,6 +66,9 @@ tables:
|
|||
type: string
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- name: place
|
||||
key: place
|
||||
type: string
|
||||
- name: natural
|
||||
key: natural
|
||||
type: string
|
||||
|
@ -101,8 +104,14 @@ tables:
|
|||
- bay
|
||||
- spring
|
||||
waterway:
|
||||
- riverbank
|
||||
- dock
|
||||
water:
|
||||
- river
|
||||
- stream
|
||||
- canal
|
||||
- ditch
|
||||
- drain
|
||||
- pond
|
||||
- basin
|
||||
- wastewater
|
||||
type: polygon
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 38 KiB Po Szerokość: | Wysokość: | Rozmiar: 46 KiB |
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"id": "water_intermittent",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "water",
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": "rgba(172, 218, 251, 1)",
|
||||
"fill-opacity": 0.85
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"==",
|
||||
"intermittent",
|
||||
1
|
||||
]
|
||||
],
|
||||
"order": 17
|
||||
},
|
||||
{
|
||||
"id": "water",
|
||||
"type": "fill",
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "water",
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
"paint": {
|
||||
"fill-color": "#aad3df"
|
||||
},
|
||||
"metadata": {},
|
||||
"filter": [
|
||||
"all",
|
||||
[
|
||||
"!=",
|
||||
"intermittent",
|
||||
1
|
||||
],
|
||||
[
|
||||
"!=",
|
||||
"brunnel",
|
||||
"tunnel"
|
||||
]
|
||||
],
|
||||
"order": 18
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
CREATE OR REPLACE FUNCTION water_class(waterway text, water text, leisure text) RETURNS text AS
|
||||
$$
|
||||
SELECT CASE
|
||||
WHEN waterway='riverbank' THEN 'river'
|
||||
WHEN water IN ('river', 'canal', 'stream', 'ditch', 'drain') THEN 'river'
|
||||
%%FIELD_MAPPING: class %%
|
||||
ELSE 'lake'
|
||||
END;
|
||||
|
@ -19,18 +19,6 @@ $$ LANGUAGE SQL IMMUTABLE
|
|||
STRICT
|
||||
PARALLEL SAFE;
|
||||
|
||||
-- Add ne_id for missing ne_50m_lakes.
|
||||
UPDATE ne_50m_lakes SET ne_id = ne_10m_lakes.ne_id
|
||||
FROM ne_50m_lakes lakes
|
||||
LEFT JOIN ne_10m_lakes USING (wikidataid)
|
||||
WHERE ne_50m_lakes.wikidataid = ne_10m_lakes.wikidataid
|
||||
AND ne_50m_lakes.ne_id = 0;
|
||||
|
||||
-- Update ne_110_lakes ne_id where two lakes (Lake Onega) have identical attributes.
|
||||
-- New ne_id is taken from ne_50m_lakes
|
||||
UPDATE ne_110m_lakes SET ne_id = 1159126421
|
||||
WHERE ne_id = 1159113251
|
||||
AND ST_Area(geometry) < 10000000000;
|
||||
|
||||
-- Get matching osm id for natural earth id.
|
||||
DROP MATERIALIZED VIEW IF EXISTS match_osm_ne_id CASCADE;
|
||||
|
|
|
@ -2,6 +2,12 @@ layer:
|
|||
id: "water"
|
||||
requires:
|
||||
tables:
|
||||
- ne_10m_lakes
|
||||
- ne_10m_ocean
|
||||
- ne_110m_lakes
|
||||
- ne_110m_ocean
|
||||
- ne_50m_lakes
|
||||
- ne_50m_ocean
|
||||
- osm_ocean_polygon
|
||||
description: |
|
||||
Water polygons representing oceans and lakes. Covered watered areas are excluded (`covered=yes`).
|
||||
|
@ -19,17 +25,22 @@ layer:
|
|||
class:
|
||||
description: |
|
||||
All water polygons from [OpenStreetMapData](http://osmdata.openstreetmap.de/) have the class `ocean`.
|
||||
Water bodies with the [`waterway=riverbank`](http://wiki.openstreetmap.org/wiki/Tag:waterway=riverbank)
|
||||
or [`water=river`](http://wiki.openstreetmap.org/wiki/Tag:water=river) tag are classified as river. Wet and dry docks
|
||||
tagged [`waterway=dock`](http://wiki.openstreetmap.org/wiki/Tag:waterway=dock) are classified as a `dock`.
|
||||
The water-covered areas of flowing water bodies with the [`water=river`](http://wiki.openstreetmap.org/wiki/Tag:water=river),
|
||||
[`water=canal`](http://wiki.openstreetmap.org/wiki/Tag:water=canal),
|
||||
[`water=stream`](http://wiki.openstreetmap.org/wiki/Tag:water=stream),
|
||||
[`water=ditch`](http://wiki.openstreetmap.org/wiki/Tag:water=ditch), or
|
||||
[`water=drain`](http://wiki.openstreetmap.org/wiki/Tag:water=drain) tags are classified as river. Wet and dry docks
|
||||
tagged [`waterway=dock`](http://wiki.openstreetmap.org/wiki/Tag:waterway=dock) are classified as a `dock`.
|
||||
Various minor waterbodies are classified as a `pond`.
|
||||
Swimming pools tagged [`leisure=swimming_pool`](https://wiki.openstreetmap.org/wiki/Tag:leisure=swimming_pool) are classified as a `swimming_pool`
|
||||
All other water bodies are classified as `lake`.
|
||||
values:
|
||||
dock:
|
||||
waterway: 'dock'
|
||||
river:
|
||||
water: 'river'
|
||||
waterway: 'riverbank'
|
||||
water: ['river', 'stream', 'canal', 'ditch', 'drain']
|
||||
pond:
|
||||
water: ['pond', 'basin', 'wastewater', 'salt_pond']
|
||||
lake:
|
||||
ocean:
|
||||
swimming_pool:
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 100 KiB Po Szerokość: | Wysokość: | Rozmiar: 109 KiB |
|
@ -21,6 +21,9 @@ tables:
|
|||
- name: place
|
||||
key: place
|
||||
type: string
|
||||
- name: natural
|
||||
key: natural
|
||||
type: string
|
||||
- name: rank
|
||||
key: rank
|
||||
type: integer
|
||||
|
@ -34,3 +37,6 @@ tables:
|
|||
place:
|
||||
- ocean
|
||||
- sea
|
||||
natural:
|
||||
- bay
|
||||
- strait
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 43 KiB Po Szerokość: | Wysokość: | Rozmiar: 57 KiB |