Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Marker clustering in mapboxgl based on aggregating value instead of point count

I've been looking at clustering markers in MapBox GL (https://www.mapbox.com/mapbox-gl-js/example/cluster/), but I was hoping to do it a little differently.

Essentially, I have a geojson file with a count of Incidents per building (point) on our campus in a property. I'd like to display that number in a marker and then as one zooms out, the markers collapse and add the values of that marker together.

The clustering examples I see simply count the points, but don't seem to provide for aggregating properties. Is such a thing doable?

like image 686
coopermj Avatar asked Apr 07 '16 16:04

coopermj


2 Answers

This functionality does not exist in mapbox-gl-js but could and should! Please use the GitHub issue for further discussion and updates. https://github.com/mapbox/mapbox-gl-js/issues/2412

like image 132
Lucas Wojciechowski Avatar answered Nov 15 '22 05:11

Lucas Wojciechowski


I can't post as a comment due to low reputation, but it looks like the ability to accept a function is unavailable as of now:

https://github.com/mapbox/mapbox-gl-js/issues/2412

like image 5
CCantey Avatar answered Nov 15 '22 07:11

CCantey