-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: added ContinuousZoomEuclideanCentroidAlgorithm #1559
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
Conversation
@stefano-maggiolo, I can't add you as a reviewer, but feel free to take a look. I have added a test, but while doing it I am thinking if it could make sense to add a sample activity that showcase the behavior for the algorithms. |
Code Coverage
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but can we have a version that combine this and the Centroid version?
# [3.15.0](v3.14.0...v3.15.0) (2025-08-19) ### Features * added ContinuousZoomEuclideanCentroidAlgorithm ([#1559](#1559)) ([b781ff8](b781ff8))
🎉 This PR is included in version 3.15.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
* feat: added ContinuousZoomEuclideanAlgorithm * feat: added ContinuousZoomEuclideanAlgorithm * feat: added ContinuousZoomEuclideanAlgorithm * feat: replaced methods in NonHierarchicalDistanceBasedAlgorithm.java * feat: refactored to create ContinuousZoomEuclideanCentroidAlgorithm.java
# [3.15.0](googlemaps/android-maps-utils@v3.14.0...v3.15.0) (2025-08-19) ### Features * added ContinuousZoomEuclideanCentroidAlgorithm ([googlemaps#1559](googlemaps#1559)) ([b781ff8](googlemaps@b781ff8))
Can we add some high level docs on when to use what? For example, it's pretty well discussed in this repo issues/prs that NonHierarchicalDistanceBasedAlgorithm is the goto when you have a ton of items, but maybe the readme can include a pros cons list or something? Thank you! |
@ColtonIdle , we were talking last week about adding an activity showcasing how all the algorithm works. We will work on this next - either a new sample, and/or documentation to showcase them. |
Love it! thank you! im a maps noob, but have to use it in a few KMP apps now so I'm trying my best to provide a good UX for everyone! |
@ColtonIdle , this will be reviewed soon, but as a reference: |
This PR adds the
ContinuousZoomEuclideanCentroidAlgorithm
, a new clustering algorithm to fix some issues present in theNonHierarchicalDistanceBasedAlgorithm
(namely, aggresivevity while clustering). It avoids the limitations ofNonHierarchicalDistanceBasedAlgorithm
, like abrupt clustering changes when zoom crosses integer levels and the square-based proximity check.The algorithm works with continuous zoom, computing the clustering radius using the fractional zoom level, so the threshold changes smoothly as you zoom in or out. This makes clustering more natural and visually consistent.
It also uses Euclidean distance to decide cluster membership. The quadtree search still uses a square for performance, but items are only added to a cluster if they fall within a circular radius, avoiding the diagonal over-merging problem.
This comes as a separate algorithm instead of changing
NonHierarchicalDistanceBasedAlgorithm
, so we don’t introduce any behavior changes for existing users.