Attempt at cleaning up the excessive office/industrial POIs, and cleaning up the subtype code while we're at it. (SQL bugs likely)
This commit is contained in:
parent
c121c69a66
commit
14238e9863
@ -29,8 +29,9 @@ SELECT CASE class
|
|||||||
WHEN 'car_parking' THEN 300
|
WHEN 'car_parking' THEN 300
|
||||||
WHEN 'charging_station' THEN 350
|
WHEN 'charging_station' THEN 350
|
||||||
WHEN 'fuel' THEN 350
|
WHEN 'fuel' THEN 350
|
||||||
WHEN 'bicycle_parking' THEN 390
|
WHEN 'bicycle_parking' THEN 360
|
||||||
WHEN 'motorcycle_parking' THEN 390
|
WHEN 'motorcycle_parking' THEN 360
|
||||||
|
WHEN 'bank' THEN 380
|
||||||
WHEN 'fast_food' THEN 400
|
WHEN 'fast_food' THEN 400
|
||||||
WHEN 'ice_cream' THEN 400
|
WHEN 'ice_cream' THEN 400
|
||||||
WHEN 'bar' THEN 450
|
WHEN 'bar' THEN 450
|
||||||
@ -49,6 +50,7 @@ SELECT CASE class
|
|||||||
WHEN 'mobile_phone' THEN 700
|
WHEN 'mobile_phone' THEN 700
|
||||||
WHEN 'shoes' THEN 700
|
WHEN 'shoes' THEN 700
|
||||||
WHEN 'clothing_store' THEN 700
|
WHEN 'clothing_store' THEN 700
|
||||||
|
WHEN 'laundry' THEN 700
|
||||||
WHEN 'florist' THEN 750
|
WHEN 'florist' THEN 750
|
||||||
WHEN 'dog_park' THEN 800
|
WHEN 'dog_park' THEN 800
|
||||||
WHEN 'pitch' THEN 800
|
WHEN 'pitch' THEN 800
|
||||||
|
|||||||
@ -29,17 +29,7 @@ SELECT osm_id_hash AS osm_id,
|
|||||||
poi_class(
|
poi_class(
|
||||||
subclass,
|
subclass,
|
||||||
mapping_key,
|
mapping_key,
|
||||||
CASE
|
subtype
|
||||||
WHEN subclass = 'information'
|
|
||||||
THEN NULLIF(information, '')
|
|
||||||
WHEN subclass = 'place_of_worship'
|
|
||||||
THEN NULLIF(religion, '')
|
|
||||||
WHEN subclass = 'pitch'
|
|
||||||
THEN NULLIF(sport, '')
|
|
||||||
WHEN subclass = 'generator' AND mapping_key = 'power'
|
|
||||||
THEN NULLIF(source, '')
|
|
||||||
ELSE subclass
|
|
||||||
END
|
|
||||||
) AS class,
|
) AS class,
|
||||||
CASE
|
CASE
|
||||||
WHEN subclass = 'information'
|
WHEN subclass = 'information'
|
||||||
@ -63,20 +53,24 @@ SELECT osm_id_hash AS osm_id,
|
|||||||
ELSE poi_class_rank(poi_class(
|
ELSE poi_class_rank(poi_class(
|
||||||
subclass,
|
subclass,
|
||||||
mapping_key,
|
mapping_key,
|
||||||
CASE
|
subtype
|
||||||
WHEN subclass = 'information'
|
|
||||||
THEN NULLIF(information, '')
|
|
||||||
WHEN subclass = 'place_of_worship'
|
|
||||||
THEN NULLIF(religion, '')
|
|
||||||
WHEN subclass = 'pitch'
|
|
||||||
THEN NULLIF(sport, '')
|
|
||||||
WHEN subclass = 'generator' AND mapping_key = 'power'
|
|
||||||
THEN NULLIF(source, '')
|
|
||||||
ELSE subclass
|
|
||||||
END
|
|
||||||
)) END ASC
|
)) END ASC
|
||||||
)::int AS "rank"
|
)::int AS "rank"
|
||||||
FROM (
|
FROM (
|
||||||
|
-- Intermediate mapping for subtype and filtering out nameless industrial/office buildings
|
||||||
|
SELECT *,
|
||||||
|
CASE
|
||||||
|
WHEN subclass = 'information'
|
||||||
|
THEN NULLIF(information, '')
|
||||||
|
WHEN subclass = 'place_of_worship'
|
||||||
|
THEN NULLIF(religion, '')
|
||||||
|
WHEN subclass = 'pitch'
|
||||||
|
THEN NULLIF(sport, '')
|
||||||
|
WHEN subclass = 'generator' AND mapping_key = 'power'
|
||||||
|
THEN NULLIF(source, '')
|
||||||
|
ELSE subclass
|
||||||
|
END as subtype
|
||||||
|
FROM (
|
||||||
-- etldoc: osm_poi_point -> layer_poi:z12
|
-- etldoc: osm_poi_point -> layer_poi:z12
|
||||||
-- etldoc: osm_poi_point -> layer_poi:z13
|
-- etldoc: osm_poi_point -> layer_poi:z13
|
||||||
SELECT *,
|
SELECT *,
|
||||||
@ -125,6 +119,8 @@ FROM (
|
|||||||
WHERE geometry && bbox
|
WHERE geometry && bbox
|
||||||
AND zoom_level >= 14
|
AND zoom_level >= 14
|
||||||
) AS poi_union
|
) AS poi_union
|
||||||
|
WHERE NOT (mapping_key = 'building' AND (subclass = 'office' OR subclass = 'industrial') AND coalesce(name, name_en, '') = '')
|
||||||
|
)
|
||||||
ORDER BY "rank"
|
ORDER BY "rank"
|
||||||
$$ LANGUAGE SQL STABLE
|
$$ LANGUAGE SQL STABLE
|
||||||
PARALLEL SAFE;
|
PARALLEL SAFE;
|
||||||
|
|||||||
@ -50,7 +50,7 @@ layer:
|
|||||||
florist:
|
florist:
|
||||||
subclass: ['florist']
|
subclass: ['florist']
|
||||||
town_hall:
|
town_hall:
|
||||||
subclass: ['townhall', 'public_building', 'courthouse', 'community_centre']
|
subclass: ['townhall', 'public_building', 'courthouse']
|
||||||
community_centre:
|
community_centre:
|
||||||
subclass: ['community_centre', 'social_facility']
|
subclass: ['community_centre', 'social_facility']
|
||||||
golf:
|
golf:
|
||||||
@ -143,6 +143,8 @@ layer:
|
|||||||
subclass: ['wind_mill']
|
subclass: ['wind_mill']
|
||||||
power_tower:
|
power_tower:
|
||||||
subclass: ['tower']
|
subclass: ['tower']
|
||||||
|
industry:
|
||||||
|
subclass: ['industrial']
|
||||||
subclass:
|
subclass:
|
||||||
description: |
|
description: |
|
||||||
Original value of either the
|
Original value of either the
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user