Merge branch 'master' of https://github.com/openmaptiles/openmaptiles into merge-github

# Conflicts:
#	Makefile
#	QUICKSTART.md
#	docker-compose.yml
#	layers/boundary/mapping.yaml
#	layers/landuse/landuse.sql
#	layers/landuse/landuse.yaml
#	layers/landuse/mapping.yaml
#	layers/poi/mapping.yaml
#	layers/poi/poi.sql
#	layers/poi/poi.yaml
This commit is contained in:
2023-04-09 20:39:41 +02:00
465 changed files with 23727 additions and 2256 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -9,6 +9,7 @@ def_poi_mapping_aerialway: &poi_mapping_aerialway
# amenity values , see http://taginfo.openstreetmap.org/keys/amenity#values
def_poi_mapping_amenity: &poi_mapping_amenity
- arts_centre
- atm
- bank
- bar
- bbq
@@ -26,7 +27,6 @@ def_poi_mapping_amenity: &poi_mapping_amenity
- dentist
- doctors
- drinking_water
- embassy
- fast_food
- ferry_terminal
- fire_station
@@ -45,6 +45,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity
- pharmacy
- place_of_worship
- police
- parcel_locker
- post_box
- post_office
- prison
@@ -121,6 +122,10 @@ def_poi_mapping_leisure: &poi_mapping_leisure
- water_park
- nature_reserve
# office values , see http://taginfo.openstreetmap.org/keys/office#values
def_poi_mapping_office: &poi_mapping_office
- diplomatic
# railway values , see http://taginfo.openstreetmap.org/keys/railway#values
def_poi_mapping_railway: &poi_mapping_railway
- halt
@@ -184,6 +189,7 @@ def_poi_mapping_shop: &poi_mapping_shop
- kiosk
- lamps
- laundry
- locksmith
- mall
- massage
- mobile_phone
@@ -345,6 +351,8 @@ def_poi_fields: &poi_fields
type: id
- name: geometry
type: geometry
- name: area
type: area
- name: name
key: name
type: string
@@ -372,6 +380,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
@@ -393,6 +404,15 @@ def_poi_fields: &poi_fields
- name: source
key: "generator:source"
type: string
- name: operator
key: operator
type: string
- name: network
key: network
type: string
- name: brand
key: brand
type: string
def_poi_mapping: &poi_mapping
aerialway: *poi_mapping_aerialway
@@ -403,6 +423,7 @@ def_poi_mapping: &poi_mapping
historic: *poi_mapping_historic
landuse: *poi_mapping_landuse
leisure: *poi_mapping_leisure
office: *poi_mapping_office
railway: *poi_mapping_railway
shop: *poi_mapping_shop
sport: *poi_mapping_sport

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@@ -94,20 +94,20 @@ 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
-- OLD
-- SELECT *,
-- NULL::integer AS agg_stop,
-- CASE
-- WHEN osm_id < 0 THEN -osm_id * 10 + 4
-- ELSE osm_id * 10 + 1
-- END AS osm_id_hash
-- FROM osm_poi_polygon
-- WHERE geometry && bbox
-- AND zoom_level BETWEEN 12 AND 13
-- AND ((subclass = 'station' AND mapping_key = 'railway')
-- OR subclass IN ('halt', 'ferry_terminal'))
--
-- UNION ALL
-- etldoc: osm_poi_polygon -> layer_poi:z14_
SELECT *,
NULL::integer AS agg_stop,
@@ -116,8 +116,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_raw
WHERE NOT (mapping_key = 'building' AND (subclass = 'office' OR subclass = 'industrial') AND coalesce(name, name_en, '') = '')
) AS poi_union

View File

@@ -18,37 +18,39 @@ layer:
values:
shop:
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist',
'coffee', 'computer', 'convenience', 'copyshop', 'cosmetics',
'erotic', 'fabric', 'frozen_food', 'video_games', 'video', 'general', 'gift',
'hearing_aids', 'hifi', 'interior_decoration', 'kiosk', 'lamps', 'mall', 'massage','outdoor',
'perfumery', 'perfume', 'pet', 'photo', 'second_hand', 'sports', 'stationery', 'tailor', 'tattoo',
'ticket', 'tobacco', 'travel_agency', 'watches', 'weapons', 'wholesale']
'coffee', 'computer', 'convenience', 'copyshop', 'cosmetics', 'garden_centre', 'doityourself',
'erotic', 'electronics', 'fabric', 'florist', 'frozen_food', 'furniture', 'video_games', 'video',
'general', 'gift', 'hardware', 'hearing_aids', 'hifi', 'ice_cream', 'interior_decoration',
'jewelry', 'kiosk', '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',
'watches', ''weapons', 'wholesale']
optician:
subclass: ['optician']
subclass: [ 'optician' ]
toys:
subclass: ['toys']
subclass: [ 'toys' ]
jewelry:
subclass: ['jewelry']
subclass: [ 'jewelry' ]
furniture:
subclass: ['furniture']
subclass: [ 'furniture' ]
newsagent:
subclass: ['newsagent']
subclass: [ 'newsagent' ]
paint:
subclass: ['paint']
subclass: [ 'paint' ]
beverages:
subclass: ['beverages']
subclass: [ 'beverages' ]
electronics:
subclass: ['electronics']
subclass: [ 'electronics' ]
garden_centre:
subclass: ['garden_centre']
subclass: [ 'garden_centre' ]
mobile_phone:
subclass: ['mobile_phone']
subclass: [ 'mobile_phone' ]
shoes:
subclass: ['shoes']
subclass: [ 'shoes' ]
hardware:
subclass: ['hardware', 'doityourself']
subclass: [ 'hardware', 'doityourself' ]
florist:
subclass: ['florist']
subclass: [ 'florist' ]
town_hall:
subclass: ['townhall', 'public_building', 'courthouse']
community_centre:
@@ -87,7 +89,7 @@ layer:
ice_cream:
subclass: ['chocolate', 'confectionery', 'ice_cream']
post:
subclass: ['post_box', 'post_office']
subclass: ['post_box', 'post_office', 'parcel_locker']
cafe:
subclass: ['cafe']
school:
@@ -126,25 +128,27 @@ layer:
subclass: ['swimming_area', 'swimming']
castle:
subclass: ['castle', 'ruins']
atm:
subclass: ['atm']
airport:
subclass: ['aerodrome']
subclass: [ 'aerodrome' ]
heliport:
subclass: ['helipad']
subclass: [ 'helipad' ]
wind_turbine:
__AND__:
subclass: ['generator']
subtype: ['wind']
mapping_key: ['power']
subclass: [ 'generator' ]
subtype: [ 'wind' ]
mapping_key: [ 'power' ]
communications_tower:
subclass: ['communications_tower']
subclass: [ 'communications_tower' ]
water_tower:
subclass: ['water_tower']
subclass: [ 'water_tower' ]
wind_mill:
subclass: ['wind_mill']
subclass: [ 'wind_mill' ]
power_tower:
subclass: ['tower']
subclass: [ 'tower' ]
industry:
subclass: ['industrial']
subclass: [ 'industrial' ]
subclass:
description: |
Original value of either the
@@ -162,7 +166,8 @@ layer:
[`tourism`](http://wiki.openstreetmap.org/wiki/Key:tourism),
[`aerialway`](http://wiki.openstreetmap.org/wiki/Key:aerialway),
[`building`](http://wiki.openstreetmap.org/wiki/Key:building),
[`highway`](http://wiki.openstreetmap.org/wiki/Key:highway)
[`highway`](http://wiki.openstreetmap.org/wiki/Key:highway),
[`office`](https://wiki.openstreetmap.org/wiki/Key:office)
or [`waterway`](http://wiki.openstreetmap.org/wiki/Key:waterway)
tag. Use this to do more precise styling.
rank: |

View File

@@ -1,3 +1,4 @@
-- etldoc: osm_poi_point -> osm_poi_stop_centroid
DROP MATERIALIZED VIEW IF EXISTS osm_poi_stop_centroid CASCADE;
CREATE MATERIALIZED VIEW osm_poi_stop_centroid AS
(
@@ -5,12 +6,14 @@ SELECT uic_ref,
count(*) AS count,
CASE WHEN count(*) > 2 THEN ST_Centroid(ST_UNION(geometry)) END AS centroid
FROM osm_poi_point
WHERE nullif(uic_ref, '') IS NOT NULL
WHERE uic_ref <> ''
AND subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
GROUP BY uic_ref
HAVING count(*) > 1
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
-- etldoc: osm_poi_stop_centroid -> osm_poi_stop_rank
-- etldoc: osm_poi_point -> osm_poi_stop_rank
DROP MATERIALIZED VIEW IF EXISTS osm_poi_stop_rank CASCADE;
CREATE MATERIALIZED VIEW osm_poi_stop_rank AS
(

View File

@@ -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
$$;

1704
layers/poi/style.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,47 +1,99 @@
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
-- use either operator or network
-- (using name for ATM is discouraged, see osm wiki)
UPDATE osm_poi_point
SET (name, tags) = (
COALESCE(tags -> 'operator', tags -> 'network'),
tags || hstore('name', COALESCE(tags -> 'operator', tags -> 'network'))
)
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) = (
CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref')),
tags || hstore('name', CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref')))
)
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
AND subclass = 'parcel_locker'
AND 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
$$
BEGIN
UPDATE osm_poi_point p
SET agg_stop = CASE
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
THEN 1
SET
agg_stop = CASE
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
THEN 1
END
WHERE
agg_stop IS DISTINCT FROM CASE
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
THEN 1
END;
UPDATE osm_poi_point p
SET agg_stop = (
SET
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)
END)
FROM osm_poi_stop_rank r
WHERE p.osm_id = r.osm_id;
WHERE p.osm_id = r.osm_id AND
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)
THEN 1
END);
END;
$$ LANGUAGE plpgsql;
@@ -52,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
(
@@ -74,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);
@@ -86,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();

View File

@@ -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
@@ -51,11 +51,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 +76,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 +93,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();