supercluster
supercluster copied to clipboard
Feature request: get zoom level at which the marker is unclustered
There's the getClusterExpansionZoom which gives the zoom level at which the existing cluster is breaking into more clusters/markers.
It would be handy to be able to zoom into a marker so it appears unclustered. The use case for this is when I select an entity related to the marker outside of the map and I need to focus on the marker in case it's out of bounds or clustered.
Or is there a way to do this with the existing methods?
Need this. @orangecoloured did you ever find a solution?
@karldanninger Sorry, I can't remember and I can't test that now.
I appreciate your quick reply, thank you! I have the coordinates of the point I'd like to zoom into, so I guess the not-so performant way to do this is:
- pan to coordinate
- zoom in one level, evaluate if point is exposed, repeat.
Any updates on this? I'm using supercluster on the server and having to manually loop over each cluster to find its getClusterExpansionZoom value and add to the properties, so I know what zoom level to use when clicking on the cluster. would be ideal, and probably more performant if supercluster could just include this property automatically?
yeah, that would be lovely! a convenience func to retrieve the minimal zoom level for a given marker.
like so https://github.com/mapbox/supercluster/pull/205/files#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R194
Any updates on this? I'm using supercluster on the server and having to manually loop over each cluster to find its getClusterExpansionZoom value and add to the properties, so I know what zoom level to use when clicking on the cluster. would be ideal, and probably more performant if supercluster could just include this property automatically?
You can loop through the clusters with a recursive function until you find your point (assuming you know it's coordinates) and remember the parent cluster of the point. Then do getClusterExpansionZoom using the parent cluster(id) and that's the zoom level you need to have your point unclustered. Not ideal but works perfectly.
@andreimp1 that's exactly what I am doing indeed