Repository navigation
Conversation
|
This works like a charm, I'd love to this this PR merged. |
Member
|
Thanks for the PR! I'd like to experiment with a different approach to be able to keep the performance while having this ability at all times (not behind an option). The idea is to save the parent id, and then range-search by bbox while filtering by id (instead of keeping arrays in each cluster, which kills performance). This should be relatively fast. |
Member
|
Done! Please check out #31 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm using supercluster with the Mapbox GL JS library. The biggest shortcoming with the supercluster clustering for good UX has been the lack of ability to reliably zoom in to the clusters. Using a fixed zoom bigger than +1 is bound to cause issues, where some of the points/clusters in the original cluster that was clicked are no longer visible.
This PR adds a includeSubPoints flag, which if turned on, includes all the coordinates of the points belonging to a cluster to the cluster's subPoints property. With the property it is easy then to calculate the proper bounding box for each cluster when they are clicked and visualize the bounds of the cluster similar to Leaflet.markercluster.
I ran some manual tests with my laptop (Macbook Pro 2.5 GHz Intel Core i7, 16 GB RAM with Google Chrome Version 53.0.2785.143 (64-bit). I used the earthquakes.geojson file found in this example with the Leaflet.js example shipped with supercluster. With the includeSubPoints flag on the cluster creation time increased about 20%, from ~50ms to ~60ms. The heap size increased from ~14.5 mb to ~15 mb.