Reworked the POI mapping so that a subtype is available. Needed for wind_turbine, but might also prove useful later.
This commit is contained in:
parent
08e4e8b0bb
commit
d6485e7dd5
@ -62,7 +62,7 @@ SELECT CASE class
|
|||||||
$$ LANGUAGE SQL IMMUTABLE
|
$$ LANGUAGE SQL IMMUTABLE
|
||||||
PARALLEL SAFE;
|
PARALLEL SAFE;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION poi_class(subclass text, mapping_key text)
|
CREATE OR REPLACE FUNCTION poi_class(subclass text, mapping_key text, subtype text)
|
||||||
RETURNS text AS
|
RETURNS text AS
|
||||||
$$
|
$$
|
||||||
SELECT CASE
|
SELECT CASE
|
||||||
|
|||||||
@ -26,7 +26,9 @@ SELECT osm_id_hash AS osm_id,
|
|||||||
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||||
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
||||||
tags,
|
tags,
|
||||||
poi_class(subclass, mapping_key) AS class,
|
poi_class(
|
||||||
|
subclass,
|
||||||
|
mapping_key,
|
||||||
CASE
|
CASE
|
||||||
WHEN subclass = 'information'
|
WHEN subclass = 'information'
|
||||||
THEN NULLIF(information, '')
|
THEN NULLIF(information, '')
|
||||||
@ -34,11 +36,19 @@ SELECT osm_id_hash AS osm_id,
|
|||||||
THEN NULLIF(religion, '')
|
THEN NULLIF(religion, '')
|
||||||
WHEN subclass = 'pitch'
|
WHEN subclass = 'pitch'
|
||||||
THEN NULLIF(sport, '')
|
THEN NULLIF(sport, '')
|
||||||
WHEN power = 'generator' AND source = 'wind'
|
WHEN subclass = 'generator' AND mapping_key = 'power'
|
||||||
THEN 'wind_turbine'
|
|
||||||
WHEN power = 'generator'
|
|
||||||
THEN NULLIF(source, '')
|
THEN NULLIF(source, '')
|
||||||
ELSE subclass
|
ELSE subclass
|
||||||
|
END
|
||||||
|
) AS class,
|
||||||
|
CASE
|
||||||
|
WHEN subclass = 'information'
|
||||||
|
THEN NULLIF(information, '')
|
||||||
|
WHEN subclass = 'place_of_worship'
|
||||||
|
THEN NULLIF(religion, '')
|
||||||
|
WHEN subclass = 'pitch'
|
||||||
|
THEN NULLIF(sport, '')
|
||||||
|
ELSE subclass
|
||||||
END AS subclass,
|
END AS subclass,
|
||||||
agg_stop,
|
agg_stop,
|
||||||
NULLIF(layer, 0) AS layer,
|
NULLIF(layer, 0) AS layer,
|
||||||
|
|||||||
@ -131,7 +131,10 @@ layer:
|
|||||||
heliport:
|
heliport:
|
||||||
subclass: ['helipad']
|
subclass: ['helipad']
|
||||||
wind_turbine:
|
wind_turbine:
|
||||||
subclass: ['wind']
|
__AND__:
|
||||||
|
subclass: ['generator']
|
||||||
|
subtype: ['wind']
|
||||||
|
mapping_key: 'aerialway'
|
||||||
communications_tower:
|
communications_tower:
|
||||||
subclass: ['communications_tower']
|
subclass: ['communications_tower']
|
||||||
water_tower:
|
water_tower:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user