Upon page load I load and show a Google Map:
var latlng = new google.maps.LatLng(lat, lng);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
>From within a select box's onchange handler I get location json and
would like to add these locations to the map.
How can I reference the map without the re-initializing part?
Something like:
var map = google.maps.Map(document.getElementById("map_canvas"));
$.each(locationCollection, function (i) {
var location = new google.maps.LatLng(this.LocationLat,
this.LocationLong);
var marker = new google.maps.Marker({
position: location,
map: map,
title: this.LocationName
});
});
--
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.