Add POI parcel locker (#1390)

closes #1370 

This PR adds a parcel locker to post class.

Similarly to ATMs from PR #1375 if a name is not present we try to use `brand` or `operator`. Here we also try to add `ref` to the brand or operator since it can disambiguate parcel lockers that are next to each other (which happens).
pull/1395/head^2
ttomasz 2022-06-01 09:32:10 +02:00 zatwierdzone przez GitHub
rodzic 7d52c9a9e5
commit 82b00c1389
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
8 zmienionych plików z 70 dodań i 1 usunięć

Wyświetl plik

@ -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

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 1.4 MiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.4 MiB

Wyświetl plik

@ -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:

Wyświetl plik

@ -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

Wyświetl plik

@ -13,4 +13,19 @@
<tag k="amenity" v="atm"/>
<tag k="network" v="OpenMapTiles ATM"/>
</node>
<node id="600004" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.5" lon="-80.5">
<tag k="amenity" v="parcel_locker"/>
<tag k="name" v="OpenMapTiles Parcel Locker"/>
<tag k="brand" v="Different operator"/>
<tag k="ref" v="PL001"/>
</node>
<node id="600005" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.6" lon="-80.6">
<tag k="amenity" v="parcel_locker"/>
<tag k="brand" v="OpenMapTiles Parcel Locker"/>
<tag k="ref" v="PL002"/>
</node>
<node id="600006" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.7" lon="-80.7">
<tag k="amenity" v="parcel_locker"/>
<tag k="operator" v="OpenMapTiles Parcel Locker"/>
</node>
</osm>

Wyświetl plik

@ -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;
$$

Wyświetl plik

@ -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;

Wyświetl plik

@ -3,11 +3,17 @@
<!--
Test 600: POIs
Change atm's network
Remove Parcel locker name and leave brand
-->
<modify>
<node id="600003" visible="true" timestamp="2020-01-02T00:00:00Z" version="1" lat="35.4" lon="-80.4">
<tag k="amenity" v="atm"/>
<tag k="network" v="New name"/>
</node>
<node id="600004" visible="true" timestamp="2020-01-02T00:00:00Z" version="1" lat="35.4" lon="-80.4">
<tag k="amenity" v="parcel_locker"/>
<tag k="brand" v="Different operator"/>
<tag k="ref" v="PL001"/>
</node>
</modify>
</osmChange>