地图中的多个样式集群

Multiple styled clusters in a map

我需要在一张地图上显示许多不同的点。到目前为止,我曾经使用 google 地图创建地图页面。我已经创建了一个带有集群的页面,但现在我需要更多。我需要这样的东西: https://www.mapbox.com/mapbox.js/example/v1.0.0/markercluster-multiple-groups/

但是我在 google 地图中没有找到这个。我对 mapbox 有疑问,因为我认为它不是免费的,所以我的公司必须为此付费。这在 google 地图中可能吗?还是传单上的?

我已经用传单做了一些事情,如果可能的话,我可以用它。但是我也没有找到任何传单。你能告诉我一些显示这种地图的教程或页面吗?

您是否尝试过 Marker Clusterer Plus library from the Google Maps Utility Library V3? The 'Advanced Example' on the How-to Page 甚至演示了聚类标记的自定义样式。

我认为您发布的示例使用 markercluster, Leaflet plugin。 Mapbox 是 Leaflet 的一个很好同步的分支,所以你可以用它来使用大部分的 Leaflet 插件。

在示例中,这段代码创建了一组颜色。 Vanilla Markercluster 插件似乎用于此。

function makeGroup(color) {
  return new L.MarkerClusterGroup({
    iconCreateFunction: function(cluster) {
      return new L.DivIcon({
        iconSize: [20, 20],
        html: '<div style="text-align:center;color:#fff;background:' +
        color + '">' + cluster.getChildCount() + '</div>'
      });
    }
  }).addTo(map);
}

查看 Markercluster 文档和您提到的示例,您应该能够构建自己的标记组。