I'm making a Leaflet map, and using the Marker Cluster plugin to cluster a Few Thousand Markers.

On of the attributes in my Data is the State that this marker lies in.

I would like that at the initial zoom level, the map show the Markers clustered by the states, i.e. Each state have one marker cluster.

How can I do this?

1 Answer 1


Simply create one Marker Cluster Group per State.

Loop through your markers, and depending on their State attribute, add them to the appropriate group.

Trying to be smarter is waaay more complicated as of today… See https://github.com/Leaflet/Leaflet.markercluster/issues/521

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.