Note that there are some explanatory texts on larger screens.

plurals
  1. POgoogle maps over query limit
    primarykey
    data
    text
    <p>I know that similar questions have been posted but I have not found and answer in any of them as it relates to my particular issue. </p> <p>I have a javascript that uses google maps to place customer zipcodes on a map. The problem I am have is similar to what others have already posted – I get a “over query limit” error. </p> <p>I have tried different setups using setTimeOut to try to send google the data within the allowable time intervals but I can’t get it to work. </p> <p>Here is my action: </p> <pre><code> function initialize() { var rowNum = 0 ; var rowColor = "" ; var latlng = new google.maps.LatLng(27.91425, -82.842617); var myOptions = { zoom: 7, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"),myOptions); geocoder = new google.maps.Geocoder(); data.forEach(function(mapData,idx) { window.setTimeout(function() { geocoder.geocode({ 'address': mapData.address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location, title: mapData.title, icon: getIcon(mapData.type) }); var contentHtml = "&lt;div style='width:250px;height:90px'&gt;&lt;strong&gt;"+mapData.title+"&lt;/strong&gt;&lt;br /&gt;"+mapData.address+"&lt;/div&gt;"; var infowindow = new google.maps.InfoWindow({ content: contentHtml }); google.maps.event.addListener(marker, 'click', function() { infowindow.open(map,marker); }); marker.locid = idx+1; marker.infowindow = infowindow; markers[markers.length] = marker; if (idx%2 == 0) { rowColor = 'style="background-color:#00FFFF;"' ; } else { rowColor = 'style="background-color:#FFFFFF;"' ; } var sideHtml = '&lt;div ' + rowColor + ' class="loc" data-locid="'+marker.locid+'"&gt;&lt;b&gt;'+mapData.title+'&lt;/b&gt;&lt;br/&gt;'; sideHtml += mapData.address + '&lt;/div&gt;'; $("#locs").append(sideHtml); //Are we all done? Not 100% sure of this if(markers.length == data.length) doFilter(); } else { // alert("Geocode was not successful for the following reason: " + status); } }, 3000); }); }); </code></pre> <p>When I run my page using this action, I get back 11 markers even though I have many more than that in my JSON string. The window.setTimeout has absolutely no effect – I’m obviously doing something wrong here. </p> <p>I would appreciate any help on this matter. </p> <p>Thanks, </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. COHow many points are you trying to display? If it is _lots_ of points [the general answer is "Don't geocode known locations every time you load your page. Geocode them off-line and use the resulting coordinates to display the markers on your page."](http://stackoverflow.com/questions/11792916/over-query-limit-in-google-maps-api-v3-how-do-i-pause-delay-in-javascript-to-sl/11793406#11793406)
      singulars
    2. COIn my current example, I’m trying to load about 100 markers from a static JSON string. In reality, I will need to dynamically load a JSON string based on a specific search criteria according to the clients needs. The client has store data in a MySQL database. The user is first prompted on a form in order to filter the necessary data – lets say sales for a specific month. I then use a Java action to query the database which in turn returns the JSON string. The Google map is done using this string. Sales are placed on the map based on the customer’s zip code.
      singulars
    3. COYou need to obtain a database of geographic coordinates for zipcodes. Geocoding 100 (or more) zipcodes on page load will take too long. They aren't going to move. Either that or do the geocoding on the server, and cache the geographic information in your database per the [terms of use](https://developers.google.com/maps/faq#tos).
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload