Monday, April 18, 2016

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

Leave a Comment

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?

2 Answers

Answers 1

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

Answers 2

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

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment