'gridSize'在'option'对象下的MarkerClusterer中定义了什么?

What does 'gridSize' define in MarkerClusterer under 'option' object?

我正在使用 MarkerClusterer 库制作 Google 地图和标记聚类。 'gridSize' 参数在 'option' 对象中到底定义了什么?如果它是以像素为单位的聚类图像的大小,那么我该如何为同一张地图中的不同聚类更改它?

我已尝试使用此处提供的文档来使用 MarkerClusterer 库 link:https://developers.google.com/maps/documentation/javascript/marker-clustering

它没有说明如何更改和添加 'option' 对象以及我们如何根据需要编辑选项代码。

我希望你能帮助我在同一张地图上为不同的集群制作不同的集群图像大小。

MarkerClusterer 库的 reference 声明:

gridSize - The grid size of a cluster in pixels.

要使用此选项,您可以在创建对象时将其添加到您的 MarkerClusterer 选项中:

var markerCluster = new MarkerClusterer(map, markers, {
  imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m',
  gridSize: 90
});

或使用setGridSize方法:

markerCluster.setGridSize(90);

要检查您的 markerCluster 当前的网格大小,请使用 getGridSize

希望对您有所帮助。