Support spiderfier-like functionality for clustering
Is there an easy way to get a spiderfier for markers that share same location?
(as in https://github.com/Leaflet/Leaflet.markercluster/blob/master/example/marker-clustering-spiderfier.html)
What would you suggest to do in such a case of overlapping markers?
Thanks java99
Is this feasible @mourner?
This is certainly very difficult to do and I don't think we'll be able to tackle this in the short term.
This would be a really great feature!
Basic spiderfying in mapbox clustering: https://bewithjonam.github.io/mapboxgl-spiderifier/docs/mapbox-gl-cluster-spiderfy.html
Library: https://github.com/bewithjonam/mapboxgl-spiderifier
Forks:
- mapbox-gl-js; https://github.com/bewithjonam/mapbox-gl-js
- mapbox-gl-style-spec: https://github.com/bewithjonam/mapbox-gl-style-spec
- supercluster: https://github.com/bewithjonam/supercluster (sent pull request)
Right now, there is no way of tracking points involved in a cluster. These forks minimally adds support for tracking points in a cluster using a property field starting from configured zoom level.
So is spidering points with the same coordinates possible in Mapbox GL js? Can anyone explain how to achieve this?
I'm clustering some points up till a certain zoom level, then they just overlap each other since they have the same lat/longs. Is there any way to spider them out when they come out of a cluster? Following this example: https://www.mapbox.com/mapbox-gl-js/example/cluster
Sorry to reopen this issue, let me know if I should open a new one instead.
Same question. The current support for spiderfier is complex. New version of supercluster supports getChildren() used by spidifier, but it has not yet been merged to mapbox-gl-js (https://github.com/mapbox/mapbox-gl-js/issues/3318). There is a working demo of supercluster/mapbox-gl-js (https://bl.ocks.org/ryanbaumann/f7eb6c9fd2b8a9a2942b0ff77b2b583a) but with older version of supercluster. So it seems that we still need several forks as mentionned on https://github.com/mapbox/mapbox-gl-js/issues/2723#issuecomment-263220618.
Could this issue be reopenned?
For those who are ReactJS lover. This is a solution to show the points at same location using spiderifier. https://github.com/thuanmb/react-mapbox-gl-spiderifier
I also vote for reopening this issue. It is a very basic use case (f.i. artworks in e museum, multi-purpose buildings, etc.) so it is strange that there is no standard solution for this.
- getChildren
- getLeaves Above methods are required to find features in a cluster. These methods have been exposed in recent versions of mapbox-gl-js.
Using those methods, you can get the features in a cluster. And then call spiderifier to spiderfy them. Doc for the same.
No forks are required anymore. Only mapboxgl-js and mapboxgl-spiderfier library.
Thanx for quick reply: Maybe i do not fully understand yet: The problem is not getting the features in the cluster, but showing all underlying symbols when you zoom in and the cluster evaporates..... But I'll try and see if I can get something working with this spiderfy library....
If anyone looks for a solution, I am working on one right here: https://github.com/mapbox/mapbox-gl-js/issues/7120
Here is an vanilla example of spiderifier using a layer or markers if anyone needs it. Github repo, Codepen
I think this is a common issue for people using cluster. It would be nice if anyone at Mapbox could add it to examples.
Sorry for late re-opening. Any standard solution available? Any Mapbox sample around? Checked last comment: thanks @FranckKe seems to be a working solution. closing again