8

I am trying to understand argument in package geopy and Nominatim geocoder.

from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="specify_your_app_name_here")

from their documentation.

What User_Agent is and how should I decide what to fill there?

7

User_Agent is an http request header that is sent with each request.

Nominatim requires this value to be set to your application name. The goal is to be able to limit the number of requests per application.

https://operations.osmfoundation.org/policies/nominatim/

Provide a valid HTTP Referer or User-Agent identifying the application (stock User-Agents as set by http libraries will not do).

Moreover, should you have a lot of queries, Nominatim asks that the user_agent also contains your email address (or that you use the email parameter)

https://nominatim.org/release-docs/develop/api/Search/

email=< valid email address >

If you are making large numbers of request please include a valid email address or alternatively include your email address as part of the User-Agent string. This information will be kept confidential and only used to contact you in the event of a problem, see Usage Policy for more details.

| improve this answer | |
  • Thanks! I have two questions. 1) If I am using GeoPy not as part of any website but just transforming database locally, what kind of http request header should I set. I've put just: "my-application" - is it ok, or should I put something more specific? 2) I cannot find information what does it mean large number of requests. In documentation, it's said that it can process 1 request per second but not the total number. I have roughly 1M address in my db for which I need to find coordinates - is geopy a good approach or should I look for something different? – Mateusz Konopelski Aug 22 '18 at 11:29
  • It doesn't matter if it is online or not, the limits still apply. You should put something more specific in order not to be confused with someone else... the easiest would be to put your email, as Nominatim asks. For 2), I don't know. – JGH Aug 22 '18 at 11:49
  • For a bulk usage the appropriate thing would be to set up your own Nominatim instance for a virtually unlimited number of requests. The easiest way to get a Nominatim instance up and running is to use Photon with the pre-compiled search index: github.com/komoot/photon – egofer Oct 2 '18 at 11:08
  • 1
    Please give an example that shows how we should use the email parameter. – Dobedani Nov 15 '18 at 14:59
  • when you create the Nominatim object, just give it your email as an argument. nominatim_service = Nominatim(user_agent='my_email@myserver.com') and then call the service on whatever your input data is geolocator = RateLimiter(nominatim_service.geocode, min_delay_seconds=1) collisions['geocodes'] = collisions['location_string'].apply(geolocator) – Hugh_Kelley Feb 27 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.