1

I want to change cluster labels on Leaflet maps generated using QGIS2WEB plugin. Actually I want these labels to show a sum of values from point attribute fields (all points on same location have that field, but different values). Also, if that is possible I want to change cluster colors depending on sum value (bigger values shades of red or orange colour, lower values shades of yellow or green) some kind of heat map. My question is what I should change in generated code to solve my problem?

1

Leaflet clustering is handled by the plugin Leaflet.markercluster. I don't know whether you can aggregate data from the points which make up the clusters. The plugin options, including ways to change colours and thresholds for when the colours change, are all listed at https://github.com/Leaflet/Leaflet.markercluster.

Looking at the details on that page, I guess you could use the method getAllChildMarkers(), and then loop through them all to sum whichever field you need. I presume this would be too much of a performance hit, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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