feat: add charging station to car POIs (#1544)

Adding charging station to class `fuel`.

Co-authored-by: Christopher Beddow <cbeddow>
Co-authored-by: Tomas Pohanka <TomPohys@gmail.com>
pull/1589/head^2
Christopher Beddow 2023-12-12 13:58:03 +01:00 zatwierdzone przez GitHub
rodzic 3cf77e2a54
commit e61442c49d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
10 zmienionych plików z 93 dodań i 5 usunięć

Wyświetl plik

@ -18,6 +18,7 @@ def_poi_mapping_amenity: &poi_mapping_amenity
- biergarten - biergarten
- bus_station - bus_station
- cafe - cafe
- charging_station
- cinema - cinema
- clinic - clinic
- college - college

Plik binarny nie jest wyświetlany.

Przed

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

Po

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

Wyświetl plik

@ -106,6 +106,8 @@ layer:
subclass: ['castle', 'ruins'] subclass: ['castle', 'ruins']
atm: atm:
subclass: ['atm'] subclass: ['atm']
fuel:
subclass: ['fuel', 'charging_station']
subclass: subclass:
description: | description: |
Original value of either the Original value of either the

Wyświetl plik

@ -997,7 +997,8 @@
"class", "class",
"car", "car",
"bicycle_parking", "bicycle_parking",
"fuel" "fuel",
"charging_station"
] ]
], ],
"order": 170 "order": 170

Wyświetl plik

@ -43,11 +43,11 @@ BEGIN
-- (using name for parcel lockers is discouraged, see osm wiki) -- (using name for parcel lockers is discouraged, see osm wiki)
UPDATE osm_poi_point UPDATE osm_poi_point
SET (name, tags) = ( SET (name, tags) = (
CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref')), TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))),
tags || hstore('name', CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))) tags || hstore('name', TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))))
) )
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids)) WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_point.osm_ids))
AND subclass = 'parcel_locker' AND subclass IN ('parcel_locker', 'charging_station')
AND name = '' AND name = ''
AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL; AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL;

Wyświetl plik

@ -36,6 +36,19 @@ $$
AND funicular = 'yes' AND funicular = 'yes'
AND subclass = 'station'; AND subclass = 'station';
-- Parcel locker and charging_station 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_polygon
SET (name, tags) = (
TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))),
tags || hstore('name', TRIM(CONCAT(COALESCE(tags -> 'brand', tags -> 'operator'), concat(' ', tags -> 'ref'))))
)
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_polygon.osm_ids))
AND subclass IN ('parcel_locker', 'charging_station')
AND name = ''
AND COALESCE(tags -> 'brand', tags -> 'operator') IS NOT NULL;
UPDATE osm_poi_polygon UPDATE osm_poi_polygon
SET tags = update_tags(tags, geometry) SET tags = update_tags(tags, geometry)
WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_polygon.osm_ids)) WHERE (full_update OR osm_id IN (SELECT osm_id FROM poi_polygon.osm_ids))

Wyświetl plik

@ -28,4 +28,28 @@
<tag k="amenity" v="parcel_locker"/> <tag k="amenity" v="parcel_locker"/>
<tag k="operator" v="OpenMapTiles Parcel Locker"/> <tag k="operator" v="OpenMapTiles Parcel Locker"/>
</node> </node>
<node id="600007" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.8" lon="-80.8">
<tag k="amenity" v="charging_station"/>
<tag k="name" v="OpenMapTiles Charging Station"/>
<tag k="brand" v="OpenMapTiles Charging Station Brand"/>
</node>
<node id="600008" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.0" lon="-80.0" />
<node id="600009" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.1" lon="-80.0" />
<node id="600010" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.1" lon="-80.1" />
<node id="600011" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="34.0" lon="-80.1" />
</node>
<node id="6000012" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="35.9" lon="-80.9">
<tag k="amenity" v="charging_station"/>
<tag k="name" v="OpenMapTiles Charging Station"/>
<tag k="operator" v="OpenMapTiles Charging Station Operator"/>
</node>
<way id="6000" timestamp="2019-01-01T00:00:00Z" version="1" visible="true">
<nd ref="600008" />
<nd ref="600009" />
<nd ref="600010" />
<nd ref="600011" />
<nd ref="600008" />
<tag k="amenity" v="charging_station"/>
<tag k="brand" v="OpenMapTiles Charging Station Brand"/>
</way>
</osm> </osm>

Wyświetl plik

@ -195,6 +195,20 @@ BEGIN
IF cnt <> 1 THEN 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); 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 IF;
-- verify that charging stations 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 = 'charging_station'
AND tags->'name' = 'OpenMapTiles Charging Station';
IF cnt <> 2 THEN
INSERT INTO omt_test_failures VALUES(600, 'import', 'osm_poi_point charging_station with name "OpenMapTiles Charging Station" expected 2, got ' || cnt);
END IF;
SELECT COUNT(*) INTO cnt FROM osm_poi_polygon
WHERE subclass = 'charging_station'
AND tags->'name' = 'OpenMapTiles Charging Station Brand';
IF cnt <> 1 THEN
INSERT INTO omt_test_failures VALUES(600, 'import', 'osm_poi_polygon charging_station with name "OpenMapTiles Charging Station Brand" expected 1, got ' || cnt);
END IF;
END; END;

Wyświetl plik

@ -98,7 +98,7 @@ BEGIN
WHERE subclass = 'parcel_locker' WHERE subclass = 'parcel_locker'
AND tags->'name' like 'OpenMapTiles Parcel Locker%'; AND tags->'name' like 'OpenMapTiles Parcel Locker%';
IF cnt <> 2 THEN IF cnt <> 2 THEN
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point atm with name "OpenMapTiles ATM" expected 2, got ' || cnt); INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point atm with name "OpenMapTiles Parcel Locker%" expected 2, got ' || cnt);
END IF; END IF;
SELECT COUNT(*) INTO cnt FROM osm_poi_point SELECT COUNT(*) INTO cnt FROM osm_poi_point
WHERE subclass = 'parcel_locker' WHERE subclass = 'parcel_locker'
@ -107,6 +107,26 @@ BEGIN
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point parcel_locker with name "Different operator PL001" expected 1, got ' || cnt); 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 IF;
-- for charging_station
SELECT COUNT(*) INTO cnt FROM osm_poi_point
WHERE subclass = 'charging_station'
AND tags->'name' = 'OpenMapTiles Charging Station';
IF cnt <> 1 THEN
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point charging_station with name "OpenMapTiles Charging Station" expected 1, got ' || cnt);
END IF;
SELECT COUNT(*) INTO cnt FROM osm_poi_point
WHERE subclass = 'charging_station'
AND tags->'name' = 'OpenMapTiles Charging Station Brand';
IF cnt <> 1 THEN
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_point charging_station with name "OpenMapTiles Charging Station Brand" expected 1, got ' || cnt);
END IF;
SELECT COUNT(*) INTO cnt FROM osm_poi_polygon
WHERE subclass = 'charging_station'
AND tags->'name' = 'OpenMapTiles Charging Station';
IF cnt <> 1 THEN
INSERT INTO omt_test_failures VALUES(600, 'update', 'osm_poi_polygon charging_station with name "OpenMapTiles Charging Station" expected 1, got ' || cnt);
END IF;
END; END;
$$; $$;

Wyświetl plik

@ -15,5 +15,18 @@
<tag k="brand" v="Different operator"/> <tag k="brand" v="Different operator"/>
<tag k="ref" v="PL001"/> <tag k="ref" v="PL001"/>
</node> </node>
<node id="600007" visible="true" timestamp="2020-01-02T00:00:00Z" version="1" lat="35.8" lon="-80.8">
<tag k="amenity" v="charging_station"/>
<tag k="brand" v="OpenMapTiles Charging Station Brand"/>
</node>
<way id="6000" timestamp="2020-01-02T00:00:00Z" version="1" visible="true">
<nd ref="600008" />
<nd ref="600009" />
<nd ref="600010" />
<nd ref="600011" />
<nd ref="600008" />
<tag k="amenity" v="charging_station"/>
<tag k="name" v="OpenMapTiles Charging Station"/>
</way>
</modify> </modify>
</osmChange> </osmChange>