So I'm trying to integrate the v3 maps with my cms (silverstripe) so
what I've done is parsed out the link of an uploaded xml file to a
html div element.
My problem is that while the XML file appears to load up the map
markers do not populate. (but the would if i used a static link).
any ideas would be greatly apperciated
var infowindow;
var map;
var htmlStr = $('div#mapContent').html();
//alert(htmlStr);
// http://localhost/playingintraffic/data.xml
function initialize() {
var myLatlng = new google.maps.LatLng(37.4419, -122.1419);
var myOptions = {
zoom: 13,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map"),
myOptions);
downloadUrl(htmlStr, function(data) {
var markers =
data.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var latlng = new
google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = createMarker(markers[i].getAttribute("time"),
latlng);
}
});
}
function createMarker(time, latlng) {
var marker = new google.maps.Marker({position: latlng, map:
map});
google.maps.event.addListener(marker, "click", function() {
if (infowindow) infowindow.close();
infowindow = new google.maps.InfoWindow({content: time});
infowindow.open(map, marker);
});
return marker;
}
--
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.