You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not a poweruser of {leaflet} so perhaps I'm doing something wrong rather than this being a bug.
There is a function markerClusterOptions() that accepts "extra options passed to underlying JavaScript object". I could not find in the function's documentation a clear answer to what those options are (again, maybe it is documented somewhere, I don't know how to navigate the {leaflet} world!), but I believe that it's referring to https://github.com/Leaflet/Leaflet.markercluster
That page claims there's a parameter called maxClusterRadius that controls how far markers need to be from each other to cluster together. According to the documentation on GitHub, this parameter accepts either a single number or a function:
maxClusterRadius: The maximum radius that a cluster will cover from the central marker (in pixels). Default 80. Decreasing will make more, smaller clusters. You can also use a function that accepts the current map zoom and returns the maximum cluster radius in pixels.
When I use this parameter with a single value, it works as expected. However, I cannot get it to work with a function. Example:
This should only cluster when you're very zoomed in, but when you zoom out it should not cluster. If you use maxClusterRadius=0 or maxClusterRadius=JS("function(zoom) { return 0; }") then the markers will never cluster. This is evidence that the above code does not work when zooming out.
I tried doing a GitHub-wide search for uses of maxClusterRadius in R, but 100% of the results used a single value and none used a function, so I can't see if other people got it to work.
The text was updated successfully, but these errors were encountered:
that there is an explicit attempt to make the option work with both a value and a function, which leads me to believe that it is supposed to work, but unfortunately I can't find any examples anywhere so I can't be sure.
I'm not a poweruser of {leaflet} so perhaps I'm doing something wrong rather than this being a bug.
There is a function
markerClusterOptions()
that accepts "extra options passed to underlying JavaScript object". I could not find in the function's documentation a clear answer to what those options are (again, maybe it is documented somewhere, I don't know how to navigate the {leaflet} world!), but I believe that it's referring to https://github.com/Leaflet/Leaflet.markerclusterThat page claims there's a parameter called
maxClusterRadius
that controls how far markers need to be from each other to cluster together. According to the documentation on GitHub, this parameter accepts either a single number or a function:When I use this parameter with a single value, it works as expected. However, I cannot get it to work with a function. Example:
This should only cluster when you're very zoomed in, but when you zoom out it should not cluster. If you use
maxClusterRadius=0
ormaxClusterRadius=JS("function(zoom) { return 0; }")
then the markers will never cluster. This is evidence that the above code does not work when zooming out.I tried doing a GitHub-wide search for uses of
maxClusterRadius
in R, but 100% of the results used a single value and none used a function, so I can't see if other people got it to work.The text was updated successfully, but these errors were encountered: