Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can supercluster be integrated with Mapbox-GL-JS? #34

Closed
mushon opened this issue Jan 19, 2017 · 11 comments
Closed

How can supercluster be integrated with Mapbox-GL-JS? #34

mushon opened this issue Jan 19, 2017 · 11 comments

Comments

@mushon
Copy link

mushon commented Jan 19, 2017

And if it can't how can we take advantage of similarly advanced clustering features in mapbox.gl.js?

@mourner
Copy link
Member

mourner commented Jan 19, 2017

Supercluster is already integrated into Mapbox GL JS — it is the library that gives it its clustering features.

@mourner mourner closed this as completed Jan 19, 2017
@mushon
Copy link
Author

mushon commented Jan 19, 2017

Oh, I see, thanks @mourner
In that case I guess the features I am missing are not currently supported by SuperCluster and are only supported by Leaflet's clustering. Specifically what I'm missing is Multiple differently styled clusters and Listing markers in clusters

@mourner
Copy link
Member

mourner commented Jan 19, 2017

@mushon you can create multiple clustered GeoJSON sources and style them differently already. As for listing markers in clusters, I'm working on this and it'll be available soon — see #32

@mushon
Copy link
Author

mushon commented Jan 19, 2017

Ok, I'll look into that. And what about declustering markers placed on the exact same geolocation. Is the star declustering feature available in Supercluster too?
star declustering

@foundryspatial-duncan
Copy link

Once we can get the cluster members from some method in Mapbox GL (getLeaves, or whatever it will be), we'll have everything we need to manually do that decluster effect (used to be called "spiderfying," I think). I'm anxiously awaiting the addition of these supercluster methods in the Mapbox GL API :)

@MathewJuma
Copy link

@mourner thanks for the support you have given on this. I am using the Superclustering class and not able to pool the info tooltip on a marker. Can't also find any documentations. Can you help please?

@thuanmb
Copy link

thuanmb commented Mar 22, 2018

For ReactJS lover, here is a solution for clustering (using supercluster) in mapbox-gl:
https://github.com/thuanmb/react-mapbox-gl-cluster

@maufarinelli
Copy link

Do you guys have an example of how to get the cluster and use all superclusters available methods (getClusters(bbox, zoom), getTile(z, x, y), getClusterExpansionZoom(clusterId)) in Mapbox GL?
The only example I found of clusters is:
https://www.mapbox.com/mapbox-gl-js/example/cluster/
and it does not any use of superclusters methods.
Thanks guys

@mourner
Copy link
Member

mourner commented Jun 21, 2018

Hey @maufarinelli, the integration is coming in mapbox/mapbox-gl-js#6829, which also includes an example. Check it out!

@maufarinelli
Copy link

AMAZING @mourner . Thanks you so much

@lonnibesancon
Copy link

Hello @mourner

Well there doesn't seem to be any simple example of what supercluster can do on the website or the repo. A simple example using something else that point_count to change the size/color of cluster would be a nice addition. Especially since not a lot of documentation is available on how to use supercluster and the only example online is broken and using old and deprecated code.

The only current example is: https://www.mapbox.com/mapbox-gl-js/example/cluster/

It does not offer the possibility to do anything about the cluster size or color based on other properties than point_count.

The other example that is using deprecated code is: https://bl.ocks.org/ryanbaumann/01b2c7fc0ddb7b27f6a72217bd1461ad unfortunately, this example is fairly complex to understand and also crashes when you zoom in too much. I am currently trying to make it work but I have to admit that I am facing quite a lot of challenge.

A nice and data-driven cluster example would be very nice as an addition to the list of example that you have online.

I even opened that SO question for that matter .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants