I've been trying to pass 5 markers to a map and have the map center
around the points but am not able to get it to function for me anymore.
This is my first time working with the V3 api so I'm not sure if I've
done something wrong as well.
var lat = new Array();
var lng = new Array();
lat[0] = 0;
lat[1] = 1;
lat[2] = 2;
lat[3] = 3;
lat[4] = 4;
lat[5] = 5;
lng[0] = 6;
lng[1] = 7;
lng[2] = 8;
lng[3] = 9;
lng[4] = 10
lng[5] = 11;
for (var i = 0; i < 5; i++) {
var location = new google.maps.LatLng(lat[i], lng[i]);
var marker = new google.maps.Marker({
position: location,
map: map
});
var j = i + 1;
marker.setTitle(j.toString());
var bounds = new google.maps.LatLngBounds(lat[i], lng[i]);
map.fitBounds(bounds);
}
Here's is a link: http://174.120.151.156/~crazychr/test2.html
I'm getting the following error message in firebug:
a.lat is not a function
http://maps.gstatic.com/intl/en_us/mapfiles/api-3/3/1b/main.js
Line 12
when I try that code, get only 2 markers and it doesn't zoom or center.
When I change it to
var bounds = new google.maps.LatLngBounds(lat[0], lng[5]);
it displays all 5 but doesn't center or adjust the zoom.
Thanks for any help you can offer.
--
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.