I'm building an interface that would take poll data in and show some results over a marker cluster using Mapbox but I don't have any experience with it.

The interface would look much like https://www.mapbox.com/mapbox.js/example/v1.0.0/leaflet-markercluster/

If you click on the cluster instead of zooming in a tooltip would show up with a breakdown of (yes/no) votes in a pie chart like this https://www.dropbox.com/s/hv4c8708wlhe4mt/Screenshot%202014-11-30%2015.27.53.png?dl=0

In the GeoJSON data I was thinking each data point would have a property to state the vote value and somehow I could look at them in aggregate at the cluster level

geoJSON structure

  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [125.6, 10.1]
  "properties": {
    "vote": "yes" //no

Is this possible using these libraries and geoJSON data structure? Am I on the right track?

2 Answers 2


The Leaflet markers clusterer can be used to show directly pie charts on the map. An example is visible on this map showing the breakdown of accidents in Oslo. The code behind is rather well explained and could be adapted for your case.


Possible to show aggregate votes in a tooltip on a markercluster?

The 1-1 sum of markers are just one type of aggregation.

What about aggregating a sub-property, in a sum, an average or something ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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