0

Via

Given the lat/long coordinates, how can we find out the city/country?

I tried to get information from the coordinates, and it works, as Farsheed writes in python. But can I get only the country as answer, does it exist such an attribute to give 'location' variable?

1 Answers1

-1
>>> from geopy.geocoders import Nominatim
>>> geolocator = Nominatim(user_agent="specify_your_app_name_here")
>>> location = geolocator.reverse("52.509669, 13.376294")
>>> print(location.address)
Potsdamer Platz, Mitte, Berlin, 10117, Deutschland, European Union
>>> print((location.latitude, location.longitude))
(52.5094982, 13.3765983)
>>> print(location.raw)
{'place_id': '654513', 'osm_type': 'node', ...}
sam
  • 21
  • 2