使用gmap3和markerclusterer plus的集群

时间:2014-05-14 19:49:51

标签: maps markerclusterer

使用gmap3和markerclusterer plus(https://code.google.com/p/google-maps-utility-library-v3/source/browse/trunk/markerclustererplus/?r=394

例如,如何指定群集应包含最少50个标记?

因此,如果它们少于50个标记,则不应将它们分组到群集中。

2 个答案:

答案 0 :(得分:1)

您可以指定您想要开始群集的号码。

在下面的示例中,有一个超过50,100或150个标记的群集。

marker: {
    values: $scope.json_coordinates,
        cluster:{
            radius:100,
                   // This style will be used for clusters with more than 50 markers
                    50: {
                        content: "<div class='cluster cluster-1'>CLUSTER_COUNT</div>",
                        width: 53,
                        height: 52
                    },
                   // This style will be used for clusters with more than 100 markers
                    100: {
                        content: "<div class='cluster cluster-2'>CLUSTER_COUNT</div>",
                        width: 56,
                        height: 55
                    },
                   // This style will be used for clusters with more than 150 markers
                   50: {
                        content: "<div class='cluster cluster-3'>CLUSTER_COUNT</div>",
                        width: 66,
                        height: 65
                   }
                },
                options: {
                    optimize: false,
                    icon: new google.maps.MarkerImage("/assets/images/overlay.png")
                }
            }

答案 1 :(得分:0)

您可以使用最小群集大小: var mc = new MarkerClusterer(map,markers,{minimumClusterSize:50});