I'm having trouble getting map markers to display using Google Maps API v3. I'm attempting to keep them all in a single array, to make displaying a large amount relatively simple. Currently, the map loads fine, but throws the error Uncaught TypeError: Object #<Object> has no method 'setValues' when attempting to draw the markers. The error repeats with each iteration run by the setTimeout(). Any recommendations will be greatly appreciated.
This is the JavaScript used:
var map;
var markers = [
[
45.768366,
-108.5975760,
'Fitness 19'
],
[
45.785684,
-108.6144625,
'Granite Fitness'
],
... (more, syntactically correct)
[
45.7920092,
-108.4886232,
'Steepworld'
]
];
function mapinit() {
var conf = {
zoom: 11,
center: new google.maps.LatLng(45.7832856,-108.5006904),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById('mapcont'),conf);
for(i in markers) {
window.setTimeout('mark('+i+')',i*200);
}
}
function mark(i){
google.maps.Marker({
position: google.maps.LatLng(markers[i][0],markers[i][1]),
animation: google.maps.Animation.DROP,
title: markers[i][2]
});
}