Reputation: 11161
to create map clusterer, i use:
markerClustererGPC = new MarkerClusterer(myMap.map, markersGPC, GPCOptions);
but sometimes it does not works, and markerClustererGPC is sometimes undefined.
i search on this problem, and realise that (it looks like) server is sometimes too fast, and cluster is not defined due to that.
if server is a bit older (slower), it works without problems.
am i right about this? what can i do to avoid this problem, to make my code proper to work on any server?
Upvotes: 2
Views: 2065
Reputation: 41
i think because google map is not loaded completed so your map is unidentified. Try add this:
var isLoad = false;
google.maps.event.addListener(map,'tilesloaded', function () {
if (!isLoad) {
isLoad = true; LoadClusterFunction();
}
});
after your call for creating map (map is variable for google map)
Upvotes: 3