Reputation: 3885
Im trying to find city name with geocoder
lib. I have float coordinates (lat and lng), I thing I did everything good (I have looked into their documentations) but I always get an error:
ValueError: Location should be a string
Error is in this line:
city_name = geocoder.google([lat, lng], mothod = 'reverse')
This is the code:
import geocoder
lat = 44.0207472303
lng = 20.9033038427
print(lat, lng)
city_name = geocoder.google([lat, lng], mothod = 'reverse')
city_name = str(city_name.city)
print(city_name)
Upvotes: 0
Views: 130
Reputation: 3618
It is method='reverse'
not mothod
in this line
city_name = geocoder.google([lat, lng], mothod = 'reverse')
Correct it to:
city_name = geocoder.google([lat, lng], method = 'reverse')
Upvotes: 1