From 9e99b337bfad867a8dd82aaec332b742958bcffe Mon Sep 17 00:00:00 2001 From: Vladislav Skukov Date: Sun, 19 May 2019 01:35:32 +0500 Subject: [PATCH] Add rivers to osm --- osm/osm.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/osm/osm.py b/osm/osm.py index 36c0ccc..3ca52ed 100644 --- a/osm/osm.py +++ b/osm/osm.py @@ -5,7 +5,7 @@ import re Api = OsmApi() pp = pprint.PrettyPrinter(indent=4) -min_lon, min_lat, max_lon, max_lat = 37.634090753,55.7350616076,37.6530593351,55.7373086289 +min_lon, min_lat, max_lon, max_lat = 30.3830262851,59.9141077326,30.4079171848,59.9222065257 def remove_duplicates(l): return [dict(t) for t in {tuple(d.items()) for d in l}] @@ -19,6 +19,13 @@ def filter_streets(objects): and 'highway' in o['data']['tag'] and 'name' in o['data']['tag'], objects)) +def filter_waterways(objects): + return list(filter(lambda o: + o['data']['tag'] != {} + and 'waterway' in o['data']['tag'] + and 'river' in o['data']['tag']['waterway'] + and 'name' in o['data']['tag'], objects)) + def filter_sightseeings(objects): return list(filter(lambda o: o['data']['tag'] != {} @@ -107,6 +114,9 @@ def describe_objects(min_lat, min_lon, max_lat, max_lon): districts = [ {'name': x['data']['tag']['name']} for x in filter_districts(objects) ] + rivers = [ + {'name': x['data']['tag']['name']} for x in filter_waterways(objects) + ] amenities = [ {'name': x['data']['tag']['name'], 'type': x['data']['tag']['amenity'], @@ -118,6 +128,7 @@ def describe_objects(min_lat, min_lon, max_lat, max_lon): 'buildings': buildings, 'sightseeings': sightseeings, 'districts': districts, + 'rivers': remove_duplicates(rivers), 'amenities': amenities} -- 2.50.1