I am dynamically creating a web page that places markers on a map.
For some reason, only a portion of the markers work each time.
There could be from a few dozen to a couple hundred.
If there only a few it works. More than ten or so and it's hit and
miss.

Here is the sample code:

<html>
<head>
<script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;sensor=true_or_false&amp;key=my key here"
type="text/javascript"></script>

<script type="text/javascript">

        // global variables
  var map = null;
  var geocoder = null;
  var zoomLevel=10;
  var markerOptions={
title:'title',
      clickable: true,
      draggable: false
  }
  var count=0;

        function initialize() {
                var address="";
                var otherInfo="";

          map = new GMap2(document.getElementById("map_canvas"));
          map.setCenter(new GLatLng(41.444657,-90.15707), zoomLevel);

          // Select a map type which supports obliques
          map.setMapType(G_NORMAL_MAP);
          map.setUIToDefault();

          // Enable the additional map types within
          //the map type collection
          map.enableRotation();

          // convert address to lon/lat (geocode) and place markers
          geocoder=new GClientGeocoder();

    // place makers here. there could be hundreds of these
     address="22069 US HWY 34  Princeton IL 61356";
     otherInfo="AGVFS-OHIO<br>location name here 1<br>10.1.16.7<br>";
     showAddress(address,otherInfo);

     address="12597 N 1950th Ave  Geneseo IL 61254";
     otherInfo="ALEXANDERS<br>location name here 2<br>10.1.1.18<br>";
     showAddress(address,otherInfo);

     address="28623 38th Ave N  Hillsdale IL 61257";
     otherInfo="ALLRD<br>location name here 3<br>10.1.4.32<br>";
     showAddress(address,otherInfo);

     address="16207 N 2980 Ave  Erie IL 61250";
     otherInfo="AMEJA<br>Jlocation name here 4<br>10.1.4.23<br>";
     showAddress(address,otherInfo);



     }

        // add to list
        function list(addr){
                var lst=document.getElementById("pickupList");
                var all=lst.innerHTML;
                var newAll=all+"<br>"+addr;

                lst.innerHTML=newAll;
        }

        // show geocoded address
                function showAddress(address,otherInfo) {
                  geocoder.getLatLng(
                    address,
                    function(point) {
                      if (!point) {
                        stat=-2;
                        display(address + " not found");
                      } else {
                        stat=0;
                        map.setCenter(point, zoomLevel);
                        var marker = new GMarker(point,markerOptions);
                        GEvent.addListener(marker, "click", function() {
                           marker.openInfoWindow(otherInfo+address);
                        });
                        map.addOverlay(marker);
                        marker.openInfoWindowHtml(otherInfo+address);
                      }
                    }
                  );
                }

        // display operational info
                function display(info){
                  count++;
                  var d=document.getElementById("pickupList");
                  var temp=d.innerHTML;
                  var newInner=temp+"<br>"+count.toString()+") "+info;
                  d.innerHTML=newInner;
                }

</script>

</head>
<body onload="initialize();" onunload="GUnload();">

<div id="map_canvas" style="width:800px;height:600px;border:1pt solid
#000;"></div>
<p>
<div id="pickupList"></div>

</body>
</html>


-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-api?hl=en.


Reply via email to