I just started using GeoPy. I need to convert a given location to latitude and longitude. However I am getting a GeocoderQuotaExceeded error. I just followed the example given in the documentation. Any help would be greatly appreciated.
from geopy.geocoders import GoogleV3
geolocator = GoogleV3()
address, (latitude, longitude) = geolocator.geocode("175 5th Avenue NYC")
GeocoderQuotaExceeded: The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time
This happened on the first request itself. i had not made any other requests ever. This was the first time I was using the application.
From my comments on the OP...
This implies that you've used up your quota from Google.
Have you set up your own Api key and checked that you're not exceeding your allowance? I assume it's using this service under the hood.
NB: If there's someone else with the same public IP using the service (University, Same company, etc) and you're not using an API key, that might account for you getting less than the 2,500 free uses.
Have a list of API's and use them randomly for each request. For Example in python
:
like keys = [key1,key1,key3....]
location = Geocoder(random.choice(keys)).geocode(address)
or
location = Geocoder(random.choice(keys)).reverse_geocode(Lat,Long)
Based on your Requirement. Your allowance would be more.
As a temporary solution, you can use VPN (which gives you another set of 2 500 requests for free).
Solution with random keys should work as well and it is better for permanent use but if you are just in process of testing (which was my case), this is a quick solution.
EDIT: As of July 2018, I'm finding the default requests per API key is 1 per day.
So you have to register a billing account with your google cloud platform to get the free approx 1000 requests per day.
Registering for your own API is a good move! @Yaswanth's answer didn't quite work for me, but from that and here: https://github.com/geopy/geopy, this does:
Step 1. Register for your private keys here: https://developers.google.com/maps/documentation/geolocation/intro
Step 2. In your python, import a good geocoder, I recommend GoogleV3.
from geopy.geocoders import GoogleV3
Step 3. then in your code, put in however many keys you have registered in that link above.
address = '1 Your Address Here' # Put in your address
geo_keys = [key1,key1,key3....] # Put in your API keys as strings
geolocator = GoogleV3( api_key=random.choice(geo_keys) )
geolocator.geocode( address )
Step 4. Then you're in business!
print(geolocator.latitude)
print(geolocator.longitude)