diff --git a/layers/poi/mapping.yaml b/layers/poi/mapping.yaml index 84377bee..ef931453 100644 --- a/layers/poi/mapping.yaml +++ b/layers/poi/mapping.yaml @@ -44,6 +44,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity - pharmacy - place_of_worship - police + - parcel_locker - post_box - post_office - prison @@ -353,6 +354,9 @@ def_poi_fields: &poi_fields - name: uic_ref key: uic_ref type: string + - name: ref + key: ref + type: string - name: religion key: religion type: string @@ -374,6 +378,9 @@ def_poi_fields: &poi_fields - name: network key: network type: string + - name: brand + key: brand + type: string def_poi_mapping: &poi_mapping aerialway: *poi_mapping_aerialway diff --git a/layers/poi/mapping_diagram.png b/layers/poi/mapping_diagram.png index 0370c320..fcfbf433 100644 Binary files a/layers/poi/mapping_diagram.png and b/layers/poi/mapping_diagram.png differ diff --git a/layers/poi/poi.yaml b/layers/poi/poi.yaml index a59699f9..0181ab6c 100644 --- a/layers/poi/poi.yaml +++ b/layers/poi/poi.yaml @@ -61,7 +61,7 @@ layer: ice_cream: subclass: ['chocolate', 'confectionery'] post: - subclass: ['post_box', 'post_office'] + subclass: ['post_box', 'post_office', 'parcel_locker'] cafe: subclass: ['cafe'] school: diff --git a/layers/poi/update_poi_point.sql b/layers/poi/update_poi_point.sql index f7c81a26..d48e4430 100644 --- a/layers/poi/update_poi_point.sql +++ b/layers/poi/update_poi_point.sql @@ -27,6 +27,18 @@ BEGIN AND name = '' AND COALESCE(tags -> 'operator', tags -> 'network') IS NOT NULL; + -- Parcel locker without name + -- use either brand or operator and add ref if present + -- (using name for parcel lockers is discouraged, see osm wiki) + UPDATE osm_poi_point + SET (name, tags) = ( + CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref')), + tags || hstore('name', CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))) + ) + WHERE subclass = 'parcel_locker' + AND name = '' + AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL; + UPDATE osm_poi_point SET tags = update_tags(tags, geometry) WHERE COALESCE(tags->'name:latin', tags->'name:nonlatin', tags->'name_int') IS NULL diff --git a/tests/import/600_import-poi.osm b/tests/import/600_import-poi.osm index 0b7ceab4..93de4f6b 100644 --- a/tests/import/600_import-poi.osm +++ b/tests/import/600_import-poi.osm @@ -13,4 +13,19 @@ + + + + + + + + + + + + + + + diff --git a/tests/test-post-import.sql b/tests/test-post-import.sql index 4f93097e..f874a25a 100644 --- a/tests/test-post-import.sql +++ b/tests/test-post-import.sql @@ -170,6 +170,20 @@ BEGIN INSERT INTO omt_test_failures VALUES(600, 'import', 'osm_poi_point atm with name "OpenMapTiles ATM" expected 3, got ' || cnt); END IF; + -- verify that parcel lockers are imported with correct name which can come from tags like brand or operator and can contain ref + SELECT COUNT(*) INTO cnt FROM osm_poi_point + WHERE subclass = 'parcel_locker' + AND tags->'name' like 'OpenMapTiles Parcel Locker%'; + IF cnt <> 3 THEN + INSERT INTO omt_test_failures VALUES(600, 'import', 'osm_poi_point parcel_locker with name like "OpenMapTiles Parcel Locker%" expected 3, got ' || cnt); + END IF; + SELECT COUNT(*) INTO cnt FROM osm_poi_point + WHERE subclass = 'parcel_locker' + AND tags->'name' like 'OpenMapTiles Parcel Locker PL00%'; + IF cnt <> 1 THEN + INSERT INTO omt_test_failures VALUES(600, 'import', 'osm_poi_point parcel_locker with name like "OpenMapTiles Parcel Locker PL00%" expected 1, got ' || cnt); + END IF; + END; $$ diff --git a/tests/test-post-update.sql b/tests/test-post-update.sql index fd8152e3..96953104 100644 --- a/tests/test-post-update.sql +++ b/tests/test-post-update.sql @@ -79,6 +79,7 @@ BEGIN -- Test 600 -- check if name was applied correctly + -- for atm SELECT COUNT(*) INTO cnt FROM osm_poi_point WHERE subclass = 'atm' AND tags->'name' = 'OpenMapTiles ATM'; @@ -91,6 +92,20 @@ BEGIN IF cnt <> 1 THEN INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point atm with name "New name" expected 1, got ' || cnt); END IF; + + -- for parcel_locker + SELECT COUNT(*) INTO cnt FROM osm_poi_point + WHERE subclass = 'parcel_locker' + AND tags->'name' like 'OpenMapTiles Parcel Locker%'; + IF cnt <> 2 THEN + INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point atm with name "OpenMapTiles ATM" expected 2, got ' || cnt); + END IF; + SELECT COUNT(*) INTO cnt FROM osm_poi_point + WHERE subclass = 'parcel_locker' + AND tags->'name' = 'Different operator PL001'; + IF cnt <> 1 THEN + INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point parcel_locker with name "Different operator PL001" expected 1, got ' || cnt); + END IF; END; diff --git a/tests/update/600_update-poi.osc b/tests/update/600_update-poi.osc index cb606c7e..e03e31f3 100644 --- a/tests/update/600_update-poi.osc +++ b/tests/update/600_update-poi.osc @@ -3,11 +3,17 @@ + + + + +