I want to have a set of links that correspond with the markers on a map that when clicked, center the map on the relevant marker and open the details to that marker.
Problem is I can't figure out how to get access to the markers in a Google map when the markers came from an external source (KML/geoRSS). Is this even possible to do when you didn't directly use JavaScript to build the map (but used a google.maps.KmlLayer with setMap())?
I don't want to have to parse the xml myself if at all possible. I just need to be able to access the markers after they have been created. Everything else is working perfectly.
Here's the script I'm using:
;(function($){
function initialize() {
var myLatlng = new google.maps.LatLng(49.496675,-102.65625);
var myOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
georssLayer = new google.maps.KmlLayer('http://localhost/geoFeed.xml');
georssLayer.setMap(map);
开发者_运维技巧 }
$(function(){
initialize();
});
})(jQuery);
Is there any kind of getMarkers() function that I'm just not seeing somewhere? I've been trying to hunt down any kind of method or even digging into my map object to find out if/where the markers information is stored but can't find anything that will get me what I need.
This is not possible with the current API.
精彩评论