620: Too many queries using the Google Maps API

I am using the Javascript Google Maps V3 API to reverse geocode a large number of places (~ 100) per page. After about 10 or so, I start getting error 620: too many requests.

What a good way to defer requests and ensure their completion, given that they are asynchronous?

EDIT: That's what I still have. It performs all requests most of the time, but does not retry failed requests.

function replaceAddresses() { var delay = 0; $(".lat-lon-address").each(function(index) { window.setTimeout(queryGeocoder, delay, this); delay += 1000; }); } function queryGeocoder(elem) { geocoder.getLocations(new GLatLng( elem.getAttribute("lat"), elem.getAttribute("lon")), function(response) { handleAddress(response, elem); }); } function handleAddress(response, elem) { if (!response || response.Status.code != 200) { console.log("status code: " + response.Status.code) } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); elem.innerHTML = place.address; } } 
+4
source share
2 answers

Last time I checked, you were allowed 2,500 geocoding requests per day (based on your ip). This should be enough for you, but you may need to get a higher limit if you use larger datasets.

Tips

Store geocoded information locally, possibly in a database. Retrieve values ​​from the database instead of using the Google web service. So it will be much faster. If there is no geographical information in the place, then you must geocode it.

When you write some new code that uses geocoding, do not check it with all 600 addresses, first try one or two addresses to make sure that you are not unnecessarily missing half of your daily manual with some dysfunctional code.

If you can use the client side of geocoding, this will not be taken into account in your limit.

+2
source

If you get 620, you probably need to reduce or decrease the number of requests.

Does your implementation comply with the terms of service? I do not see any code that displays these results on the map (according to TOS).

+1
source

All Articles