0
我正在使用javascript和v3的地圖API從融合表中提取一些數據。我已經成功地爲某些點添加了一些自定義標記,但現在正嘗試將我創建的標記「默認」添加到名爲「圖標」的我的表中的列中指定的圖標。我不使用融合表層,而是在數據的for循環中創建標記。在我的表中的圖標列有條目,如:'poi','星'等...Google Maps API - 從融合表中的字符串列中獲取圖標標記
有沒有任何方式使用名稱字符串以某種方式得到那些'默認'圖標像融合表層會呢?或者,有沒有人知道我可以在哪裏找到默認融合表圖標(例如POI和Star)的絕對位置,以便我可以在腳本中定義它們的路徑?
以下是一些示例代碼。如果有人知道Google上圖標的絕對URL,我可以編寫一個函數,根據'Icon'列中的字符串輸入。
//if there's an image, use it as marker, else use default
if(row[3] != ''){
// Create the marker
var marker = new google.maps.Marker({
map: map,
position: coordinate,
icon: new google.maps.MarkerImage(row[3])
});
} else {
// Create the marker
var marker = new google.maps.Marker({
map: map,
position: coordinate
//icon: row[2] (row[2] is the Icon column.
// I'm assuming I'll just need a conditional to check
// for the name (such as 'poi') and then to put in the absolute URL for each respectively
// the problem is I don't know the absolute URL's for these icons. Thanks.
});
}