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

geojson clusterArrayType option #4606

Closed
wants to merge 1 commit into from

Conversation

andrewharvey
Copy link
Contributor

At high clusterMaxZoom values and low clusterRadius values with data very close together, the default supercluster Float32Array type starts causing some features to cluster when they shouldn't based on your set clusterRadius.

To resolve this I've exposed an option on cluster sources to set the supercluster type to Float64Array.

I've posted this PR as a WIP for now as I don't think we should actually expose this option like this. I'm thinking we should try to determine based on the clusterMaxZoom and clusterRadius set that (we we just assume there will be very close data present) if Float32Array would suffice or if we need Float64Array and set it transparently.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@HarelM
Copy link
Collaborator

HarelM commented Aug 27, 2024

supercluster package is currently not maintained by us.
I would suggest trying to open a PR there as a starting point to see that this is accepted and there's a new version.
Regarding how to solve this here in terms of API is a later concern from my point of view.
Maybe in the supercluster there will be a way to solve this internally instead of exposing the array type and there won't be a need to solve it here...?

@andrewharvey
Copy link
Contributor Author

I have mapbox/supercluster#249.

I did this as a quick solution to a problem I faced, but I agree it needs more thought as to if this should be exposed like this, or if supercluster should internally decide when it would run into precision issues with Float32Array and then automatically enable Float64Array.

I feel the latter is better to avoid exposing this complexity to the user, and in that case this PR is void.

@HarelM
Copy link
Collaborator

HarelM commented Aug 27, 2024

Let's see if there's a response in the supercluster in the next week or two.

@andrewharvey
Copy link
Contributor Author

I'll close this one, as this is likely not the best solution for the issue.

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

Successfully merging this pull request may close these issues.

2 participants