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

Cluster range / min cluster size #7

Closed
meierjan opened this issue Jan 29, 2018 · 8 comments
Closed

Cluster range / min cluster size #7

meierjan opened this issue Jan 29, 2018 · 8 comments

Comments

@meierjan
Copy link
Contributor

Hey, thank you for writing this library - google maps utils really lacks maintainers...

I wonder if it's possible to change the range of the clusters. I've just seen the screenshots and the clusters seem very far apart.

Thanks in advance.

@makovkastar
Copy link
Member

Hi @meierjan. There is no public API in the library to change this, but you can modify the source code. Find the method ClusterManager.getClusters(...) and increase the value of the tileCount variable (line 138). The higher the value, the closer clusters will be to each other.

For example I changed it to this: long tileCount = (long) (Math.pow(2, zoomLevel) * 4); and the result is the following:

device-2018-01-30-122623

@meierjan
Copy link
Contributor Author

Hey, thanks for the heads up. I dug into the source code and found exactly this spot. How do you feel about adding this to the public api? Maybe I can provide a PR

@makovkastar
Copy link
Member

How would you name the method for setting this value?

@meierjan
Copy link
Contributor Author

I will read the source-code completely to understand what actually happens under the hood and then come back with a naming idea. I saw quad-trees so something like grid-size was my first intention.

@makovkastar
Copy link
Member

I feel like grid-size is too technical and exposes the internal implementation details. If you have other ideas, please let me know.

@meierjan meierjan changed the title Cluster range Cluster range / min cluster size Jan 30, 2018
@meierjan
Copy link
Contributor Author

meierjan commented Jan 30, 2018

After thinking for a while what I really wanted was a minimum cluster size. Like not render them as clusters if there a less then X markers in the bucket. So you are free to close this issue if you don't think a "grid-size" is a good feature.

@meierjan
Copy link
Contributor Author

I did it like this. Maybe you have some thoughts:
https://github.com/meierjan/google-maps-clustering/pull/1/files

@makovkastar
Copy link
Member

The minimum cluster size is a good candidate to add to the public API. Please send a pull request and I will take a look.

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

2 participants