overpass-turbo
overpass-turbo copied to clipboard
Python overpass query to pull the country and address for a given latitude longitude
HI, can someone help me to understand how to use overpass query in python to pull the short address and country for a given latitude and longitude. I am unable to use googleapi, as it is paid now. Nominatim is also not working for me.
thansk, Sree
Nominatim is giving me the below error -
ConfigurationError: Using Nominatim with default or sample user_agent
"geopy/2.2.0" is strongly discouraged, as it violates Nominatim's ToS https://operations.osmfoundation.org/policies/nominatim/ and may possibly cause 403 and 429 HTTP errors. Please specify a custom user_agent
with Nominatim(user_agent="my-application")
or by overriding the default user_agent
: geopy.geocoders.options.default_user_agent = "my-application"
.
For the below code. import geopy from geopy.geocoders import Nominatim import pandas, os dir (geopy) nom = Nominatim()
initialize Nominatim API
geolocator = Nominatim(user_agent="tutorial") coordinates = "53.480837, -2.244914" location = geolocator.reverse(coordinates) address = location.raw['address']
Is this mean I should have an account(paid) to use this, to get a valid user agent? Can someone please help?
Thanks, Sree
@Sreedhanya-K The error message is impressive precise. This has nothing to do with paid or free service.
User agent must really be the name of your application contacting nominatim. If your application is doing something bad the admins do want to be able to contact YOU and not the authors of "geopy".
So use the provided sample configuration.