Leaflet MarkerCluster 在缩放时停止自动重新聚类
Leaflet MarkerCluster stop auto re-clustering when zooming
当您放大和缩小时,标记聚类会自动 "re-cluster",因为它会再次计算聚类。
是否可以选择在更改缩放时禁用自动重新聚类?
Is there an option for to disable the auto re-cluster when the zoom is changed?
没有
在 Leaflet.MarkerCluster 中,集群取决于 maxClusterRadius
选项的值,该选项以当前缩放级别 的屏幕像素为单位 。
我鼓励您看看其他 Leaflet plugins for clustering,因为其中一些具有不依赖于缩放级别的聚类算法。
根据您要实现的目标,您可能对 Leaflet.MarkerCluster.Freezable 子插件感兴趣:
When frozen / disabled, clusters will no longer split / merge on map zoom, but retain their status as if they were on the specified zoom level.
例如,如果您希望群集反映缩放 15 配置:
var map = L.map("map"),
mcg = L.markerClusterGroup(options);
mcg.addLayers(arrayOfMarkers);
mcg.addTo(map);
mcg.freezeAtZoom(15);
免责声明:我是该子插件的作者。
当您放大和缩小时,标记聚类会自动 "re-cluster",因为它会再次计算聚类。
是否可以选择在更改缩放时禁用自动重新聚类?
Is there an option for to disable the auto re-cluster when the zoom is changed?
没有
在 Leaflet.MarkerCluster 中,集群取决于 maxClusterRadius
选项的值,该选项以当前缩放级别 的屏幕像素为单位 。
我鼓励您看看其他 Leaflet plugins for clustering,因为其中一些具有不依赖于缩放级别的聚类算法。
根据您要实现的目标,您可能对 Leaflet.MarkerCluster.Freezable 子插件感兴趣:
When frozen / disabled, clusters will no longer split / merge on map zoom, but retain their status as if they were on the specified zoom level.
例如,如果您希望群集反映缩放 15 配置:
var map = L.map("map"),
mcg = L.markerClusterGroup(options);
mcg.addLayers(arrayOfMarkers);
mcg.addTo(map);
mcg.freezeAtZoom(15);
免责声明:我是该子插件的作者。