我目前在我的项目中使用OverlappingMarkerSpiderfier。 我想展示一个蜘蛛标记下的元素数量,就像Google Maps API中的一个集群一样。
我实现的代码如下所示:
google.maps.event.addListener(marker, 'spider_format', function(status) {
if(status == OverlappingMarkerSpiderfier.markerStatus.SPIDERFIED
|| status == OverlappingMarkerSpiderfier.markerStatus.UNSPIDERFIABLE)
{
marker.setIcon('Markers/marker.png');
//use a regular marker if the element is already spiderfied or if it can not be spiderfied
}
if(status == OverlappingMarkerSpiderfier.markerStatus.SPIDERFIABLE)
{
marker.setIcon('Markers/cluster_marker.png'); //use a cluster marker
// get the number of elements under the cluster....
// show the number of elements under the cluster....
}
});
有没有办法在每个蜘蛛侠标记下获得要捕获的元素数量?