"ValueError: Must be a coordinate pair or Point" in python for lat and lon -
the following code package geopy python (https://geopy.readthedocs.org/en/1.10.0/):
from geopy.geocoders import nominatim geolocator = nominatim() location = geolocator.reverse("52.509669, 13.376294") print(location.address) >>>potsdamer platz, mitte, berlin, 10117, deutschland, european union it takes input lat , lon , returns address. in code have recieved lat , lon of image using flikcr api follows
photo_list = flickr.photos.search(api_key=api_key, accuracy = 15, has_geo=1, per_page = 100, extras = 'tags, url_s') i want following:
for photo in photo_list[0]: photo_location = flickr.photos_geo_getlocation(photo_id=photo.attrib['id']) lat = photo_location[0][0].attrib['latitude'] lon = photo_location[0][0].attrib['longitude'] geolocator = nominatim() location = geolocator.reverse(lat, lon) print(location.address) >>>potsdamer platz, mitte, berlin, 10117, deutschland, european union the lat , lon being obtained fine. if try print them each time print perfectly. have have imported geopy , relevant @ top of program. getting error : valueerror: must coordinate pair or point.
i new python appreciate help! how able input lat , lon each time. thank you!
Comments
Post a Comment