python - Get tag information from openstreetmap, specifically tag info -


i have code giving me information geotag of image have obtained flickr. code following:

geolocator = nominatim() location = geolocator.reverse("{}, {}".format(lat, lon)) print(location.address) print url print(location.raw) dict = location.raw osmid = dict.get('osm_id', 'default_value_if_null_here') osmtype = dict.get('osm_type', 'default_value_if_null_here') print osm_type 

i obtaining lat, lon , url variables image obtain. using geopy package receive following results

5, linnaeusweg, paardenveld, ijsselstein, bestuur regio utrecht, utrecht, nederland, 3401ms, nederland https://farm2.staticflickr.com/1456/24640378196_c096ea190b_m.jpg {u'display_name': u'5, linnaeusweg, paardenveld, ijsselstein, bestuur regio utrecht, utrecht, nederland, 3401ms, nederland', u'place_id': u'37712154', u'lon': u'5.0540829', u'osm_type': u'node', u'licence': u'data \xa9 openstreetmap contributors, odbl 1.0. http://www.openstreetmap.org/copyright', u'osm_id': u'2919181986', u'lat': u'52.0175634', u'address': {u'town': u'ijsselstein', u'industrial': u'paardenveld', u'house_number': u'5', u'country': u'nederland', u'county': u'bestuur regio utrecht', u'suburb': u'ijsselstein', u'state': u'utrecht', u'postcode': u'3401ms', u'country_code': u'nl', u'road': u'linnaeusweg'}} node 

the ultimate goal of code somehow use openstreetmap see if location corresponds landmark. question follows.

if take results come osm_type node, how input info have received openstreetmap info node such following example found

< node id =" 592637238 " lat =" 47.1675211 " lon =" 9.5089882 "        version ="2" changeset =" 6628391 "        user =" phinret " uid =" 135921 "        timestamp =" 2010 -12 -11 t19:20:16z " >    < tag k=" amenity " v=" bar " / >    < tag k=" name " v=" black pearl " / > 

if data maybe use tags see if landmark. have looked osmapi not know how use it

sorry how rambling question new python openstreetmap appreciated!

you can download node details via api, example node id 2919181986: http://www.openstreetmap.org/api/0.6/node/2919181986. keep in mind nominatim returns nodes, ways , relations, each element need different api call. issue corresponding landmark might further away (e.g. when photographing large building or mountain), nearest result must not correct one.

another approach skip nominatim , use overpass api instead returning data around coordinates in question. way can @ results , weight them importance , distance. need single call each coordinate because overpass api returns tags.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -