mapbox / supercluster

A very fast geospatial point clustering library for browsers and Node.
ISC License
2.08k stars 298 forks source link

get all markers in a cluster #201

Closed crisfcodes closed 1 year ago

crisfcodes commented 2 years ago

I'm using superclsuter for clustering markers in react native map, what I want is to get all children from a cluster no matter what level of nesting a cluster may have.

to explain the situation a little better, a cluster can have markers and other clusters as children, I need to flatten the child clusters to get markers inside them.

cluster
  marker
  cluster(3 markers)

// this should return the 4 markers, the top-level marker, and markers within the child cluster
cflorez10 commented 1 year ago

@mourner any idea how to do this?

mourner commented 1 year ago

The method for doing this is called getLeaves, you can see the docs for it here: https://github.com/mapbox/supercluster#getleavesclusterid-limit--10-offset--0