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:
Miel Truyen 2020-08-10 18:24:23 +02:00
parent c121c69a66
commit 14238e9863
3 changed files with 25 additions and 25 deletions

View File

@ -29,8 +29,9 @@ SELECT CASE class
WHEN 'car_parking' THEN 300
WHEN 'charging_station' THEN 350
WHEN 'fuel' THEN 350
WHEN 'bicycle_parking' THEN 390
WHEN 'motorcycle_parking' THEN 390
WHEN 'bicycle_parking' THEN 360
WHEN 'motorcycle_parking' THEN 360
WHEN 'bank' THEN 380
WHEN 'fast_food' THEN 400
WHEN 'ice_cream' THEN 400
WHEN 'bar' THEN 450
@ -49,6 +50,7 @@ SELECT CASE class
WHEN 'mobile_phone' THEN 700
WHEN 'shoes' THEN 700
WHEN 'clothing_store' THEN 700
WHEN 'laundry' THEN 700
WHEN 'florist' THEN 750
WHEN 'dog_park' THEN 800
WHEN 'pitch' THEN 800

View File

@ -29,17 +29,7 @@ SELECT osm_id_hash AS osm_id,
poi_class(
subclass,
mapping_key,
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
subtype
) AS class,
CASE
WHEN subclass = 'information'
@ -63,6 +53,12 @@ SELECT osm_id_hash AS osm_id,
ELSE poi_class_rank(poi_class(
subclass,
mapping_key,
subtype
)) END ASC
)::int AS "rank"
FROM (
-- Intermediate mapping for subtype and filtering out nameless industrial/office buildings
SELECT *,
CASE
WHEN subclass = 'information'
THEN NULLIF(information, '')
@ -73,9 +69,7 @@ SELECT osm_id_hash AS osm_id,
WHEN subclass = 'generator' AND mapping_key = 'power'
THEN NULLIF(source, '')
ELSE subclass
END
)) END ASC
)::int AS "rank"
END as subtype
FROM (
-- etldoc: osm_poi_point -> layer_poi:z12
-- etldoc: osm_poi_point -> layer_poi:z13
@ -125,6 +119,8 @@ FROM (
WHERE geometry && bbox
AND zoom_level >= 14
) AS poi_union
WHERE NOT (mapping_key = 'building' AND (subclass = 'office' OR subclass = 'industrial') AND coalesce(name, name_en, '') = '')
)
ORDER BY "rank"
$$ LANGUAGE SQL STABLE
PARALLEL SAFE;

View File

@ -50,7 +50,7 @@ layer:
florist:
subclass: ['florist']
town_hall:
subclass: ['townhall', 'public_building', 'courthouse', 'community_centre']
subclass: ['townhall', 'public_building', 'courthouse']
community_centre:
subclass: ['community_centre', 'social_facility']
golf:
@ -143,6 +143,8 @@ layer:
subclass: ['wind_mill']
power_tower:
subclass: ['tower']
industry:
subclass: ['industrial']
subclass:
description: |
Original value of either the