MarkerClusterGroup is a function that clusters points and return their aggregation.
See: example
In my case I have some polygons to which I calculated the centroids. Instead of returning the lines between centroids when hovering on the cluster. I want to return the polygons associated to those centroids. which means that I'll have a highlight on the polygons that have been clustered.
Basically, this is what I did for the time being, it will create the cluster and return the volume. But I want Onhover to highlight the polygons assiciated with the markers(centroids in my case):
var clusters = L.markerClusterGroup({
iconCreateFunction: function(cluster) {
var markers = cluster.getAllChildMarkers();
var volume = 0;
for (var i = 0; i<markers.length;i++){
if (!isNaN(markers[i].value)){
volume += markers[i].value
}
}
return L.divIcon({ html: '<b> Total Volume: ' + volume + '</b>' });
}
});
how can I achieve it ?