I am working on an Android app that displays a map, and when the user clicks on it, it takes the Lat/Lng and send them to my Rails server, that does the reverse_geocoding and store the address and the coordinates in the database. Then, the user can see the map with all the places around his location displayed.
I just added the functionality to create the place via the app yesterday, before that I used activeadmin directly in Rails, and everything was working fine. But yesterday, when testing my app, I suddenly got the Google API error :
Google Geocoding API error: over query limit
How is that possible ? I know there is a limit of 2500 request/day but I am far from that number, I did maybe 50 creations yesterday, in a 2 hours period. It works again when I wait like 30 minutes or so...
For the reverse geocoding I am using Geocoder. Is that possible that Location.near does a request to Google API each time ? Normally it does not request Google servers when Lat/Lng are provided, but it checks only in the database, right ?
Or can it be my app that sends this kind of request to Google servers each time I display the map ?
I am a bit lost here...
Thanks !
Geocoding services also limit based on queries per second as well, which may be the reason for that message.
Geocoder does makes an API call every time you call Location.near("foo") (in order to get the lat/lon of the foo). In combination with geocoding your models, you may be hitting the rate limit.
You may want to try adding some retry logic when the query limit exception is called, or getting the lat/long from your Android app and pass that directly to the query, avoiding the .near geolocation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With