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:
@@ -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,20 +53,24 @@ SELECT osm_id_hash AS osm_id,
|
||||
ELSE poi_class_rank(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
|
||||
)) 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, '')
|
||||
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:z13
|
||||
SELECT *,
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user