Is it possible to toggle between clustered and unclustered with a leaflet MarkerClusterGroup?
I know I can disable clustering at max zoom levels using the disableClusteringAtZoom param below
markerHolder = new L.MarkerClusterGroup({
disableClusteringAtZoom: 18,
maxClusterRadius: 80,
spiderfyDistanceMultiplier: 1,
})
I would like to add a button that clusters/unclusters on click
Best Answer
There is no 'uncluster' function to call per se, but you could keep both a clustered and unclustered version of your data available, and toggle between them when you click a button
see: https://github.com/Leaflet/Leaflet.markercluster/issues/393