FWIW, I made a Leaflet.markercluster subplugin for such feature a while ago: Leaflet.MarkerCluster.Freezable
It provides extra methods on Leaflet.markercluster, including disableClustering()
and enableClustering()
, which enable you to uncluster / cluster programmatically (e.g. on a button click) without needing the user to zoom in/out.
See also the plugin demo page.
Of course, you should be careful whenever you call disableClustering()
, since you may instantly load all your markers on map (if you are zoomed out to their full extent). If that tries loading thousands of markers, you may freeze your browser or even crash it.
Disclaimer: I am the author of this plugin.
See also this post on StackOverflow: With Leaflet markercluster, how can I switch between clustered and unclustered without changing zoom level?