I was wondering if someone had the same issue I have sometimes:
I am querying Google's servers and geocoding some places with a setTimeout() loop which resembles the following:
//...
var loop = function() {
setTimeout(function() {
// Here I do the geocode request and create a CustomOverlay which I then show on the map.
setTimeout(loop, 0); // Let the browser do some other work, e.g. rendering
}, 125);
};
loop();
//...
Now, I have set the timeout to 125 milliseconds, which means that within 1 second at most 8 requests (8 * 125 = 1000) are made. But sometimes I get the Google's OVER_QUERY_LIMIT status code after a while when the script executes.
Now the documentation (https://developers.google.com/maps/documentation/geocoding/usage-limits) says:
Users of the standard API:
- 2,500 free requests per day
- 10 requests per second
Why is OVER_QUERY_LIMIT returned in my case? Is it because I also create a custom Overlay? I use the method overlayProjection.fromLatLngToDivPixel() for each result to convert the lat and lng returned from the Geocoder to pixels and to draw the overlay on the map. Maybe because of it?
Thanks for the attention.