Google マップ API v3 で markerclusterer v3 を使用して 50 個のマーカーをクラスター化しようとして苦労しています。
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/docs/examples.htmlにある簡単な例に従って関数をビルドしましたが、マップが読み込まれるとfirebug で次のエラーが発生します。
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 呼び出しを実行してサーバーからポイントを取得し、マーカーの配列を作成してからマーカークラスターに追加するだけです。
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);
});
}
これにより、Googleマップのmain.jsがこのように失敗する理由は何ですか? マーカーの配列なしで MarkerClusterer を追加すると、マップはエラーなしでレンダリングされます。
マーカーの配列を追加すると、マップ エラーが発生します。
ありがとう、
許す