I'm trying to find a good way to limit the speed at which I submit geocoding requests to the Google Maps API v3 geocoding service. I know that Javascript does not have any good wait or sleep , because its execution is so far single-threaded.
Each geocoding request is sent inside the jQuery each function. So, the general code skeleton:
$(xml).find('foo').each(function(){
How to set a fixed waiting interval between each call on geocode ? If I send each request as fast as Javascript will work, I will quickly start receiving OVER_QUERY_LIMIT responses, even if I send only 20 requests. This is expected, and I try to make my client play well with Google.
An alternative route that I am ready to continue is to completely abandon Javascript for geocoding and write it in Java. With Java, it would be very easy to sleep between requests.
However, I could not find a way to use the Google geocoding service (in particular, using version 3 of the API) in Java. GeoGoogle seems to be out of date for over a year, and uses v2.
Can this be done in Java, and if so, how?
source share