Tile duplicate housenumber filtering (#1391)
This PR introduces simple filtering of duplicate housenumbers. Simple means that filtering is done withing the tile. Duplicates are defined as same housenumber, street, block_number[1]. Duplicates are usually caused by POIs. People like to add addresses to them. Most POIs have names so to prioritize addresses we pick features without names first. Formula is: `row_number() OVER(PARTITION BY concat(street, block_number, housenumber) ORDER BY has_name ASC) == 1`
This commit is contained in:
@@ -15,9 +15,19 @@ SELECT
|
||||
osm_id,
|
||||
geometry,
|
||||
housenumber
|
||||
FROM osm_housenumber_point
|
||||
WHERE zoom_level >= 14
|
||||
AND geometry && bbox;
|
||||
FROM (
|
||||
SELECT
|
||||
osm_id,
|
||||
geometry,
|
||||
housenumber,
|
||||
row_number() OVER(PARTITION BY concat(street, block_number, housenumber) ORDER BY has_name ASC) as rn
|
||||
FROM osm_housenumber_point
|
||||
WHERE 1=1
|
||||
AND zoom_level >= 14
|
||||
AND geometry && bbox
|
||||
) t
|
||||
WHERE rn = 1;
|
||||
|
||||
$$ LANGUAGE SQL STABLE
|
||||
-- STRICT
|
||||
PARALLEL SAFE;
|
||||
|
||||
Reference in New Issue
Block a user