I am adding a matching function to one of the internal tools used by my company. In short, we have a list of about 50 addresses that need to be placed on the map. I use Google Maps, so this is an interactive map and then the JavaScript API for geocoding and adding markers.
According to Google documentation , I am limited to 10 requests per second. So, I found that my javascript iterates over an array of addresses and puts a delay between each batch.
So, my function is configured with two confif variables that I can set: addressesPerBatch and timeoutPerBatch - it's pretty obvious what everyone should do. You might think that judging by the Google documentation, I would be allowed
addressesPerBatch = 10; timeoutPerBatch = 1000; //That in milliseconds
I definitely do not. I hit my bid limit very quickly when I submit requests quickly. The sweet spot I found is actually around "
addressesPerBatch = 2; timeoutPerBatch = 2000;
So, is this a problem with my javascript or a Google speed limit problem?
I created jsfiddle so you can better understand what exactly I am doing: http://jsfiddle.net/Qt4gV/1/
source share