Leaflet.MarkerCluster.LayerSupport demo page

Compatibility with L.Control.Layers

First quarter
Second quarter
Third quarter
Fourth quarter

Use the above buttons to dynamically checkIn / checkOut / add / remove Layer Groups to/from the MCG Layer Support group. See the effect on the Layers Control.

Use the top right Layers Control to dynamically add / remove Layer Groups from the map. Notice that child markers are actually added to / removed from the Marker Cluster Group!

This is the standard Leaflet Layers Control.

Note: it is normal that the computed clusters depend on the order of insertion. This is a result of Leaflet.markercluster algorithm.

Note: if your usage requires only compatibility of MCG with L.Control.Layers, you might be interested in this more simple plugin: Leaflet.FeatureGroup.SubGroup.

This example is directly adapted from Leaflet.markercluster demo page. The only difference is that markers are added to 4 different Layer Groups which are checked into the MCG Layer Support group, instead of markers being directly added to the MCG.