I am using django-cities and GeoPy. I am trying to get city name, id and country name, id based on given latitude and longitude.
Normally this is how you can get city and country using GeoPy.
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent='test', timeout=3)
location = geolocator.reverse('52.5094982,13.3765983')
loc_dict = location.raw
print(loc_dict['address'])
and this is the output:
{'suburb': 'Tiergarten', 'country_code': 'de', 'country': 'Deutschland', 'postcode': '10117', 'attraction': 'Potsdamer Platz', 'road': 'Potsdamer Platz', 'city': 'Berlin', 'city_district': 'Mitte', 'state': 'Berlin'}
In Django this is how I'm trying to get them.
Normally it should work, my problem is that GeoPy returns country: Deutschland whereas in django-cities it's Germany. And this happens to cities as well, GeoPy gives me București and django-cities Bucharest.
How can i get city name and country name like in django-cities? If i get the name like in django-cities i can get the id.