Hi, I'm new to the google maps API and javascript so I'm stumped on a really 
easy problem. I'm just trying to load markers onto a map whose latitude and 
longitudes I have stored in 2 separate arrays. I feel like my code should 
work, I really can't see what I'm doing wrong. 

      var markersArray = [];
      
    var latArray = [12.666666, 12.1, 12.3, 12.5, 12.3212];
   
    var lonArray = [51.666666, 51.1, 51.3, 51.5, 51.3212];

    var j = 0;


    while (j < latArray.length)

    {

    var myLatLng = new google.maps.LatLng(latArray[j], lonArray[j]);

    new myMarker = new google.maps.Marker({position: myLatLng, map: map});

   markersArray.push(myMarker);

   j++;

    }



This code is inside an 'Initialize' function so it should start running as 
soon as the page opens. I know this code starts to run but gets stuck 
somewhere (i assume where it sets the position of the new marker) because my 
map doesn't geolocate which should happen after the loop, and my action 
listeners to add more markers are not engaged. These functions worked 
perfectly fine before I added this part. I'm sure its a simple solution but 
its stumped me for hours.



-- 
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.

Reply via email to