I have some points that I want to be clustered in a L.MarkerClusterGroup
, which works well:
var cluster = new L.MarkerClusterGroup(options);
features.foreach(function(feature) {
var layer = L.marker(feature, {title: feature.name});
cluster.addLayer(layer);
});
And some geofences that that I don't want clustered, in a drawable layer, which also works well:
var easel = L.FeatureGroup().addTo(map);
map.draw = new L.Control.Draw({edit: {featureGroup: easel}});
How can I add the cluster featureGroup
to the editable featureGroup
, so that the points get clustered and are editable?
I have tried adding the individual feature layers into both feature groups, but then I see both the cluster and all the individual points at the same time. The editing would have to occur only if you've zoomed in far enough to see an individual marker of a cluster.
Ideally, it would be great I could have a parent featureGroup, and have those two featureGroups as children then make the parent drawable. But I haven't seen any documentation to suggest this is possible:
// psuedo code only, may not even be possible
parent = L.FeatureGroup().addTo(map);
easel = L.FeatureGroup().addTo(map);
cluster = new L.MarkerClusterGroup(options);
easel.addTo(parent);
cluster.addTo(parent);
map.draw = new L.Control.Draw({edit: {featureGroup: parent}});