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

[question] is there an easy way to change the maxClusterRadius and refresh the clusters? #1084

Open
forgotten-map opened this issue Jan 4, 2023 · 2 comments

Comments

@forgotten-map
Copy link

I'm developing an app where the user gets to select the maxClusterRadius as an input,
and I would really like a way to easily update the maxClusterRadius, and then the clusters too.

I was trying with something like:

myMarkerClusterGroup.options.maxClusterRadius = newRadius;
myMarkerClusterGroup.refreshClusters();

but it doesn't seems to be working.

The only way that I spotted so far is to recreate the MarkerClusterGroup with the new radius value.
The problem is that this way I have to add again all the layers, and since I'm using a layerGroup, it get's very annoying since not all sub-groups should be added.

Is there no easier way to change the radius and refresh the clusters?

@Alberto-Amo-Marin
Copy link

I'm having the same issue...
@forgotten-map did you get any solution?

@forgotten-map
Copy link
Author

@Alberto-Amo-Marin
no, not a real solution,
after I update the radius
I have to use clearLayers() and then add again the layers to the cluster with addLayers (and for me is a bit annoying because I need to check which layers should be added and which layer should not).
I haven't found an easier/better solution.

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