點擊我需要獲取標記圖標網址,我在谷歌地圖文檔中看到有函數getIcon()但不知道在哪裏調用它。谷歌地圖點擊獲取標記圖標網址
google.maps.event.addListener(layer, 'click', function (kmlEvent) {
alert(kmlEvent.getIcon());//Object #<Object> has no method 'getIcon'
showInContentWindow(map, kmlEvent);
});
更新:
var myOptions = {
zoom: 8,
center: null,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("kmlMapCanvas"), myOptions);
var layer = new google.maps.KmlLayer(
'https://maps.google.co.uk/maps/ms?msid=207817312541605896974.0004cdbf70e9c541de0ac&msa=0&ll=51.499019,-0.58382&spn=0.070103,0.209255&output=kml',
{
suppressInfoWindows: true,
map: map
});
google.maps.event.addListener(layer, 'click', function (kmlEvent) {
alert(kmlEvent.getIcon());//Object #<Object> has no method
showInContentWindow(map, kmlEvent);
});
在那裏我失去與本地標記連接....
非常感謝你,你節省了我很多時間。 :) –