From b6b98f9c10da4bb3f8b22be4529c4cd817e7984a Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Wed, 1 Aug 2018 21:47:51 +0300 Subject: [PATCH] Fix a small error in make_tram_areas --- stop_areas/make_tram_areas.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/stop_areas/make_tram_areas.py b/stop_areas/make_tram_areas.py index 9403f47..443faba 100755 --- a/stop_areas/make_tram_areas.py +++ b/stop_areas/make_tram_areas.py @@ -60,6 +60,14 @@ def overpass_request(bbox): return json.load(reader(response))['elements'] +def is_part_of_stop(tags): + if tags.get('public_transport') in ('platform', 'stop_position'): + return True + if tags.get('railway') == 'platform': + return True + return False + + def add_stop_areas(src): if not src: raise Exception('Empty dataset provided to add_stop_areas') @@ -89,8 +97,9 @@ def add_stop_areas(src): if el_id(m) not in elements: continue pel = elements[el_id(m)] - if (pel['tags'].get('railway') != 'platform' and - pel['tags'].get('public_transport') != 'platform'): + if not is_part_of_stop(pel['tags']): + continue + if pel['tags'].get('railway') == 'tram_stop': continue coords = pel.get('center', pel) station = stations.search_nn((coords['lon'], coords['lat']))[0].data