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:
parent
168e8300c0
commit
3b4650fca1
@ -15,9 +15,19 @@ SELECT
|
|||||||
osm_id,
|
osm_id,
|
||||||
geometry,
|
geometry,
|
||||||
housenumber
|
housenumber
|
||||||
|
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
|
FROM osm_housenumber_point
|
||||||
WHERE zoom_level >= 14
|
WHERE 1=1
|
||||||
AND geometry && bbox;
|
AND zoom_level >= 14
|
||||||
|
AND geometry && bbox
|
||||||
|
) t
|
||||||
|
WHERE rn = 1;
|
||||||
|
|
||||||
$$ LANGUAGE SQL STABLE
|
$$ LANGUAGE SQL STABLE
|
||||||
-- STRICT
|
-- STRICT
|
||||||
PARALLEL SAFE;
|
PARALLEL SAFE;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ layer:
|
|||||||
description: |
|
description: |
|
||||||
Everything in OpenStreetMap which contains a `addr:housenumber` tag useful for labelling housenumbers on a map.
|
Everything in OpenStreetMap which contains a `addr:housenumber` tag useful for labelling housenumbers on a map.
|
||||||
This adds significant size to *z14*. For buildings the centroid of the building is used as housenumber.
|
This adds significant size to *z14*. For buildings the centroid of the building is used as housenumber.
|
||||||
|
Duplicates within a tile are dropped if they have the same street/block_number (records without name tag are prioritized for preservation).
|
||||||
buffer_size: 8
|
buffer_size: 8
|
||||||
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
||||||
fields:
|
fields:
|
||||||
|
|||||||
@ -22,6 +22,16 @@ $$
|
|||||||
WHERE (full_update OR osm_id IN (SELECT osm_id FROM housenumber.osm_ids))
|
WHERE (full_update OR osm_id IN (SELECT osm_id FROM housenumber.osm_ids))
|
||||||
AND ST_GeometryType(geometry) <> 'ST_Point'
|
AND ST_GeometryType(geometry) <> 'ST_Point'
|
||||||
AND ST_IsValid(geometry);
|
AND ST_IsValid(geometry);
|
||||||
|
|
||||||
|
-- we don't need exact name just to know if it's present
|
||||||
|
UPDATE osm_housenumber_point
|
||||||
|
SET has_name =
|
||||||
|
CASE
|
||||||
|
WHEN has_name = '' THEN '0'
|
||||||
|
ELSE '1'
|
||||||
|
END
|
||||||
|
WHERE (full_update OR osm_id IN (SELECT osm_id FROM housenumber.osm_ids));
|
||||||
|
|
||||||
$$ LANGUAGE SQL;
|
$$ LANGUAGE SQL;
|
||||||
|
|
||||||
SELECT convert_housenumber_point(true);
|
SELECT convert_housenumber_point(true);
|
||||||
|
|||||||
@ -12,6 +12,15 @@ tables:
|
|||||||
- name: housenumber
|
- name: housenumber
|
||||||
key: addr:housenumber
|
key: addr:housenumber
|
||||||
type: string
|
type: string
|
||||||
|
- name: street
|
||||||
|
key: addr:street
|
||||||
|
type: string
|
||||||
|
- name: block_number
|
||||||
|
key: addr:block_number
|
||||||
|
type: string
|
||||||
|
- name: has_name
|
||||||
|
key: name
|
||||||
|
type: string
|
||||||
type_mappings:
|
type_mappings:
|
||||||
points:
|
points:
|
||||||
addr:housenumber:
|
addr:housenumber:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user