1
我努力嘗試使用markerclusterer v3和Google Maps API v3對50個標記進行聚類。markcluster和谷歌地圖v3錯誤「a is undefined」
我已經按照在發現簡單的例子:但是建立我的功能時,在地圖載入我得到的螢火以下錯誤:
a is undefined
Ba(H,function(a){if(!a)return l;return...){return new P(this.T.d,this.P.b,i)}; main.js (line 13)
我的功能只是做一個簡單的JSON通話從服務器獲取點,然後在將它們添加到markerclusterer之前構建標記數組。
function addMarkerCluster(){
//get json data and create array of map markers and mark up the map using
//a map cluster
$.getJSON("feed/kml.php?action=json",
function(data){
var map;
var markers = [];
var latlng = new google.maps.LatLng(24.91654, 15.31326);
var myOptions = {
zoom: 3,
center: latlng,
mapTypeId: google.maps.MapTypeId.HYBRID
};
map = new google.maps.Map(document.getElementById("googlemap"), myOptions);
google.maps.event.addListener(map, "tilesloaded", function(){
attachFancyBox();
hideLoadDialog();
});
//loop through the data and add to the markers array the lat/lng of the centerpoints
//as google lat/lng objects.
$.each(data, function(i){
latlng = new google.maps.LatLng(this.lat, this.lng);
var marker = new google.maps.Marker(latlng);
markers.push(marker);
});
var markerCluster = new MarkerClusterer(map, markers);
});
}
知道爲什麼這是導致谷歌地圖main.js以這種方式失敗?如果我只添加沒有標記數組的MarkerClusterer,那麼地圖可以無錯地渲染。
當我添加標記數組,然後映射錯誤。
感謝,
格蘭特
+1感謝..我需要更新我的插件..你可以在什麼源你找到解決辦法說(網頁,論壇..) – krembo99 2012-03-09 18:34:37