Rail stations 2 (#255)

* rail stations

* Create 'railway' POI class with 'station' and 'halt' subclasses

* Introduce subway stops as POI

* Revert unwanted changes in .env and openmaptiles.yaml

* Remove halt key from documentation

* Distinguish aeroway and railway station, add tram_stop
pull/262/head
Jiri Kozel 2017-05-23 17:06:23 +02:00 zatwierdzone przez GitHub
rodzic 8a44e72328
commit 9584f69035
6 zmienionych plików z 34 dodań i 4 usunięć

2
.env
Wyświetl plik

@ -5,4 +5,4 @@ POSTGRES_HOST=postgres
POSTGRES_PORT=5432 POSTGRES_PORT=5432
QUICKSTART_MIN_ZOOM=0 QUICKSTART_MIN_ZOOM=0
QUICKSTART_MAX_ZOOM=7 QUICKSTART_MAX_ZOOM=7
DIFF_MODE=false DIFF_MODE=false

Wyświetl plik

@ -4,6 +4,7 @@ RETURNS INT AS $$
WHEN 'hospital' THEN 20 WHEN 'hospital' THEN 20
WHEN 'park' THEN 25 WHEN 'park' THEN 25
WHEN 'cemetery' THEN 30 WHEN 'cemetery' THEN 30
WHEN 'railway' THEN 40
WHEN 'bus' THEN 50 WHEN 'bus' THEN 50
WHEN 'attraction' THEN 70 WHEN 'attraction' THEN 70
WHEN 'harbor' THEN 75 WHEN 'harbor' THEN 75
@ -28,7 +29,7 @@ RETURNS INT AS $$
END; END;
$$ LANGUAGE SQL IMMUTABLE; $$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION poi_class(subclass TEXT) CREATE OR REPLACE FUNCTION poi_class(subclass TEXT, mapping_key TEXT)
RETURNS TEXT AS $$ RETURNS TEXT AS $$
SELECT CASE SELECT CASE
WHEN subclass IN ('accessories','antiques','art','beauty','bed','boutique','camera','carpet','charity','chemist','chocolate','coffee','computer','confectionery','convenience','copyshop','cosmetics','garden_centre','doityourself','erotic','electronics','fabric','florist','furniture','video_games','video','general','gift','hardware','hearing_aids','hifi','ice_cream','interior_decoration','jewelry','kiosk','lamps','mall','massage','motorcycle','mobile_phone','newsagent','optician','outdoor','perfumery','perfume','pet','photo','second_hand','shoes','sports','stationery','tailor','tattoo','ticket','tobacco','toys','travel_agency','watches','weapons','wholesale') THEN 'shop' WHEN subclass IN ('accessories','antiques','art','beauty','bed','boutique','camera','carpet','charity','chemist','chocolate','coffee','computer','confectionery','convenience','copyshop','cosmetics','garden_centre','doityourself','erotic','electronics','fabric','florist','furniture','video_games','video','general','gift','hardware','hearing_aids','hifi','ice_cream','interior_decoration','jewelry','kiosk','lamps','mall','massage','motorcycle','mobile_phone','newsagent','optician','outdoor','perfumery','perfume','pet','photo','second_hand','shoes','sports','stationery','tailor','tattoo','ticket','tobacco','toys','travel_agency','watches','weapons','wholesale') THEN 'shop'
@ -37,6 +38,8 @@ RETURNS TEXT AS $$
WHEN subclass IN ('fast_food','food_court') THEN 'fast_food' WHEN subclass IN ('fast_food','food_court') THEN 'fast_food'
WHEN subclass IN ('park','bbq') THEN 'park' WHEN subclass IN ('park','bbq') THEN 'park'
WHEN subclass IN ('bus_stop','bus_station') THEN 'bus' WHEN subclass IN ('bus_stop','bus_station') THEN 'bus'
-- because 'station' might be from both aeroway and railway
WHEN (subclass='station' AND mapping_key = 'railway') OR subclass IN ('halt', 'tram_stop', 'subway') THEN 'railway'
WHEN subclass IN ('camp_site','caravan_site') THEN 'campsite' WHEN subclass IN ('camp_site','caravan_site') THEN 'campsite'
WHEN subclass IN ('laundry','dry_cleaning') THEN 'laundry' WHEN subclass IN ('laundry','dry_cleaning') THEN 'laundry'
WHEN subclass IN ('supermarket','deli','delicatessen','department_store','greengrocer','marketplace') THEN 'grocery' WHEN subclass IN ('supermarket','deli','delicatessen','department_store','greengrocer','marketplace') THEN 'grocery'

Wyświetl plik

@ -7,10 +7,10 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, name_de
SELECT osm_id, geometry, NULLIF(name, '') AS name, SELECT osm_id, geometry, NULLIF(name, '') AS name,
COALESCE(NULLIF(name_en, ''), name) AS name_en, COALESCE(NULLIF(name_en, ''), name) AS name_en,
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de, COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
poi_class(subclass) AS class, subclass, poi_class(subclass, mapping_key) AS class, subclass,
row_number() OVER ( row_number() OVER (
PARTITION BY LabelGrid(geometry, 100 * pixel_width) PARTITION BY LabelGrid(geometry, 100 * pixel_width)
ORDER BY CASE WHEN name = '' THEN 2000 ELSE poi_class_rank(poi_class(subclass)) END ASC ORDER BY CASE WHEN name = '' THEN 2000 ELSE poi_class_rank(poi_class(subclass, mapping_key)) END ASC
)::int AS "rank" )::int AS "rank"
FROM ( FROM (
-- etldoc: osm_poi_point -> layer_poi:z14_ -- etldoc: osm_poi_point -> layer_poi:z14_

Wyświetl plik

@ -101,6 +101,12 @@ def_poi_mapping_leisure: &poi_mapping_leisure
- swimming_pool - swimming_pool
- water_park - water_park
# railway values , see http://taginfo.openstreetmap.org/keys/railway#values
def_poi_mapping_railway: &poi_mapping_railway
- station
- halt
- tram_stop
# shop values , see http://taginfo.openstreetmap.org/keys/shop#values # shop values , see http://taginfo.openstreetmap.org/keys/shop#values
def_poi_mapping_shop: &poi_mapping_shop def_poi_mapping_shop: &poi_mapping_shop
- accessories - accessories
@ -311,6 +317,11 @@ tables:
type: string type: string
- name: subclass - name: subclass
type: mapping_value type: mapping_value
- name: mapping_key
type: mapping_key
- name: station
key: station
type: string
mapping: mapping:
aerialway: *poi_mapping_aerialway aerialway: *poi_mapping_aerialway
amenity: *poi_mapping_amenity amenity: *poi_mapping_amenity
@ -319,6 +330,7 @@ tables:
historic: *poi_mapping_historic historic: *poi_mapping_historic
landuse: *poi_mapping_landuse landuse: *poi_mapping_landuse
leisure: *poi_mapping_leisure leisure: *poi_mapping_leisure
railway: *poi_mapping_railway
shop: *poi_mapping_shop shop: *poi_mapping_shop
sport: *poi_mapping_sport sport: *poi_mapping_sport
tourism: *poi_mapping_tourism tourism: *poi_mapping_tourism
@ -344,6 +356,11 @@ tables:
type: string type: string
- name: subclass - name: subclass
type: mapping_value type: mapping_value
- name: mapping_key
type: mapping_key
- name: station
key: station
type: string
mapping: mapping:
aerialway: *poi_mapping_aerialway aerialway: *poi_mapping_aerialway
amenity: *poi_mapping_amenity amenity: *poi_mapping_amenity
@ -352,6 +369,7 @@ tables:
historic: *poi_mapping_historic historic: *poi_mapping_historic
landuse: *poi_mapping_landuse landuse: *poi_mapping_landuse
leisure: *poi_mapping_leisure leisure: *poi_mapping_leisure
railway: *poi_mapping_railway
shop: *poi_mapping_shop shop: *poi_mapping_shop
sport: *poi_mapping_sport sport: *poi_mapping_sport
tourism: *poi_mapping_tourism tourism: *poi_mapping_tourism

Wyświetl plik

@ -20,6 +20,8 @@ layer:
[`amenity`](http://wiki.openstreetmap.org/wiki/Key:amenity), [`amenity`](http://wiki.openstreetmap.org/wiki/Key:amenity),
[`leisure`](http://wiki.openstreetmap.org/wiki/Key:leisure), [`leisure`](http://wiki.openstreetmap.org/wiki/Key:leisure),
[`landuse`](http://wiki.openstreetmap.org/wiki/Key:landuse), [`landuse`](http://wiki.openstreetmap.org/wiki/Key:landuse),
[`railway`](http://wiki.openstreetmap.org/wiki/Key:railway),
[`station`](http://wiki.openstreetmap.org/wiki/Key:station),
[`sport`](http://wiki.openstreetmap.org/wiki/Key:sport), [`sport`](http://wiki.openstreetmap.org/wiki/Key:sport),
[`tourism`](http://wiki.openstreetmap.org/wiki/Key:tourism) [`tourism`](http://wiki.openstreetmap.org/wiki/Key:tourism)
or [`shop`](http://wiki.openstreetmap.org/wiki/Key:shop) or [`shop`](http://wiki.openstreetmap.org/wiki/Key:shop)
@ -34,6 +36,7 @@ layer:
srid: 900913 srid: 900913
query: (SELECT geometry, name, name_en, name_de, class, subclass, rank FROM layer_poi(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t query: (SELECT geometry, name, name_en, name_de, class, subclass, rank FROM layer_poi(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
schema: schema:
- ./poi_update.sql
- ./poi_polygon_update.sql - ./poi_polygon_update.sql
- ./class.sql - ./class.sql
- ./layer.sql - ./layer.sql

Wyświetl plik

@ -0,0 +1,6 @@
UPDATE osm_poi_point
SET subclass = 'subway'
WHERE station = 'subway' and subclass='station';
UPDATE osm_poi_polygon
SET subclass = 'subway'
WHERE station = 'subway' and subclass='station';