What I found out is that there is a limitation for number of geo requests. You can put all your points into array and loop through them to create a geo request. As soon as response from the server would be OVER_QUERY_LIMIT, you can set up a Timer with a second delay and continue the loop.
On May 14, 12:46 am, Chris <[email protected]> wrote: > Does anyone have any ideas as to why I can't get more than 11 markers > to plot on the map? I could really use some help on this one. > > <head> > <meta http-equiv="content-type" content="text/html; > charset=UTF-8" /> > <title> > Map > </title> > <style> > #map_canvas{width:650px; height:512px; position: > relative; } #overlay_map{width:128px; > height:128px; border: solid 3px gray; border-width: 3px 0 > 1px 3px; } > </style> > <script type="text/javascript" src="http://maps.google.com/ > maps/api/js?sensor=false"> > </script> > </head> > > <body> > <div id="map_canvas"> > </div> > <div id="overlay_map"> > </div> > <script type="text/javascript"> > // Initialize two maps > var geocoder; > var arrayLat = new Array(); > var arrayLon = new Array(); > var global_address = new Array(); > var counterK = 0; > geocoder = new google.maps.Geocoder(); > var map = new > google.maps.Map(document.getElementById('map_canvas')); > > var overlayMap = new google.maps.Map( > document.getElementById('overlay_map'), { > mapTypeId: google.maps.MapTypeId.ROADMAP, > disableDefaultUI: true > }); > > // Set up zoom_changed listeners so that overlayMap's zoom > changes to be 4 > // less than map's and map's 4 greater than overlayMap's. > > google.maps.event.addListener(map, 'zoom_changed', > function() { > var newZoom = Math.max(map.getZoom() - 4, 0); > if (overlayMap.getZoom() != newZoom) > overlayMap.setZoom(newZoom); > }); > google.maps.event.addListener(overlayMap, 'zoom_changed', > function() { > var newZoom = overlayMap.getZoom() + 4; > if (map.getZoom() != newZoom) map.setZoom(newZoom); > }); > > // overlayMap's center stays in sync with map's center > overlayMap.bindTo('center', map, 'center'); > map.setZoom(8); > map.setCenter(new google.maps.LatLng(0, 0)); > map.setMapTypeId(google.maps.MapTypeId.ROADMAP); > > var overDiv = overlayMap.getDiv(); > map.getDiv().appendChild(overDiv); > overDiv.style.position = "absolute"; > overDiv.style.right = "0px"; > overDiv.style.bottom = "14px"; > overDiv.style.zIndex = 10; > > google.maps.event.addListener(overlayMap, 'idle', > function() { > overlayMap.getDiv().style.zIndex = 10; > }); > Getaddress(); > > function Getaddress() { > global_address.push({ > address: '420 Ponce De Leon Ave NE Atlanta, GA > 30308', > latlng: null > }); > global_address.push({ > address: '146 Eleanor St SE Atlanta, GA 30317', > latlng: null > }); > global_address.push({ > address: '6255 Barfield Rd Ste 100 Atlanta, GA > 30328', > latlng: null > }); > global_address.push({ > address: '660 Clifton Rd SE Atlanta, GA 30316', > latlng: null > }); > global_address.push({ > address: '595 Joseph E Lowery Rd Atlanta, GA > 30310', > latlng: null > }); > global_address.push( { address: 'Nashville, > TN', latlng: > null } ); > global_address.push({ > address: '2959 Duluth Highway 120 Atlanta, GA > 30096', > latlng: null > }); > global_address.push({ > address: '100 Alabama St SW Atlanta, GA 30303', > latlng: null > }); > global_address.push({ > address: '3254 Northside Pkwy NW Atlanta, GA > 30327', > latlng: null > }); > global_address.push({ > address: '72 Cleveland Ave SW Atlanta, GA 30315', > latlng: null > }); > global_address.push({ > address: '475 Boulevard NE Atlanta, GA 30308', > latlng: null > }); > > global_address.push({ > address: '3689 Campbellton Rd SW Atlanta, GA > 30331', > latlng: null > }); > global_address.push({ > address: '3133 Piedmont Road, Atlanta, GA 30305', > latlng: null > }); > global_address.push({ > address: '1394 N Highland Ave, Atlanta, GA 30306', > latlng: null > }); > //global_address.push( { address: '1261 W Paces Ferry, > Atlanta, GA 30327', latlng: null } ); > > global_address.push({ > address: '1077 Juniper St, Atlanta, GA 30309', > latlng: null > }); > global_address.push({ > address: '3285 Peachtree Rd NE, Atlanta, GA > 30305', > latlng: null > }); > global_address.push({ > address: '406 W Ponce De Leon Ave, Decatur, GA > 30030', > latlng: null > }); > global_address.push({ > address: '402 E Howard Avenue, Decatur, GA 30030', > latlng: null > }); > global_address.push({ > address: '121 Sycamore Street, Decatur, gA 30030', > latlng: null > }); > > //alert(global_address.length); > > for (var i = 0; i < global_address.length; i++) { > fnSearchAddress(global_address[i]) > } > > } > > function fnSearchAddress(adres) { > var address = adres.address; > if (geocoder) { > > geocoder.geocode({'address': > address},function(results, status) { > > if (status == > google.maps.GeocoderStatus.OK){ > > map.setCenter(results[0].geometry.location); > > var strHTML = "<div>" + address + "<br>" + > results[0].geometry.location + "</div>"; > arrayLat[counterK] = > results[0].geometry.location.b > arrayLon[counterK] = > results[0].geometry.location.c > counterK++; > > var infowindow = new > google.maps.InfoWindow({ > content: strHTML > }); > > var marker = new google.maps.Marker({ > position: > results[0].geometry.location, > map: map, > title: '' > }); > google.maps.event.addListener(marker, > 'click', function() { > infowindow.open(map, marker); > }); > }; > if (global_address != 'undefined') > > if (counterK != > global_address.length) { > > var minLat = Math.min.apply(null, > arrayLat); > var maxLat = Math.max.apply(null, > arrayLat); > var minLon = Math.min.apply(null, > arrayLon); > var maxLon = Math.max.apply(null, > arrayLon); > var centralLat = minLat + (maxLat - > minLat) / 2 > var centralLon = minLon + (maxLon - > minLon) / 2 > > var zoomLvl = 10; > var dist = (6371 * Math.acos( > Math.sin(minLat / 57.2958) * > Math.sin(maxLat / 57.2958) + ( > Math.cos(minLat / 57.2958) * > Math.cos(maxLat / 57.2958) * Math.cos(maxLon / 57.2958 - minLon / > 57.2958)))); > > if (dist < 24576) > > zoomLvl = 1; > > if (dist < 12288) > > zoomLvl = 2; > > if (dist < 6144) > > zoomLvl = 3; > > if (dist < 3072) > > zoomLvl = 4; > > if (dist < 1536) > > zoomLvl = 5; > > if (dist < 768) > > zoomLvl = 6; > > if (dist < 384) > > zoomLvl = 7; > > if (dist < 192) > > zoomLvl = 8; > > if (dist < 96) > > zoomLvl = 9; > > if (dist < 48) > > zoomLvl = 10; > > if (dist < 24) > > zoomLvl = 11; > > if (dist < 11) > > zoomLvl = 12; > > if (dist < 4.8) > > zoomLvl = 13; > > if (dist < 3.2) > > zoomLvl = 14; > > if (dist < 1.6) > > zoomLvl = 15; > > if (dist < 0.8) > > zoomLvl = 16; > > if (dist < 0.3) > > zoomLvl = 17; > > map.setCenter(new > google.maps.LatLng(centralLat, centralLon), zoomLvl); > map.setZoom(zoomLvl); > > } > } > ); > } > } > </script> > </body> > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/google-maps-js-api-v3?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
