Skip to content Skip to sidebar Skip to footer

Javascript Google Maps, Displays Only 10 Markers Out Of 100. Is There A Limit?

Here is the link: http://alchemist3d.com/maptest.html Also I'm using geocoder in a loop to get the coordinates of an array of addresses, here is the code: function initialize() {

Solution 1:

Yes, there is a rate limit, which isn't too well documented. 9-10 requests per second? If you check the error status, it's called OVER_QUERY_LIMIT. With 100 markers, I don't think the common waiting technique will do you much good, because you have a lot of markers. It's best to geocode once, save the LatLngs and use them.

If you're brave, you can try:

setTimeout(function(){
  geocoder.geocode(geoOptions, createGeocodeCallback(list[i], map));
}, 200*i);

I don't know why everyone uses 200 ms, maybe from trial and error? You can try 150, or 100. Still, at 100 ms it will take you 10 seconds to load 100 markers. Another idea I read about is to query in batches. Geocode ten, wait, then another ten.

An alternate function you can try is sleep.

functionsleep(milliSeconds) {
  var startTime = newDate().getTime();
  while (newDate().getTime() < startTime + milliSeconds);
}

Solution 2:

Lilina is right about the rate limit, but it's possible to vary the rate depending on whether you fall foul of it or not. 200ms is likely to OK all the time, but see also this linked question where there's an example of a varying rate which starts faster than that (and is actually only slowed down to around 150ms).

The problem recounted there is exactly the same as yours.

Google Map V3 : Only some markers are displayed

Post a Comment for "Javascript Google Maps, Displays Only 10 Markers Out Of 100. Is There A Limit?"