Leaflet.markercluster
Leaflet.markercluster copied to clipboard
Disable clustering for clusters below a certain number?
Hello, quick question about your great leaflet plugin. Is there any way that I could make it so that my markers will no longer cluster if the cluster is below a certain number. For example, I don't want to see clusters smaller than a size of 5. Instead, I'd like to see all 5 (or 4, 3, 2) markers being displayed individually on the map. Thank you for your help!
Another possible solution to my issue that maybe you could help me with: Is it possible to toggle the clustering on/off? So a user could click on a button that's on the same page as the map and then enable and disable the clustering by clicking that button. That way they have the option to see individual markers rather than clusters if they wish to. Thanks!
-
Nope, it's sort of complicated to implement well, so it hasn't been done. (There have been a few requests for it now, so maybe worth implementing)
-
Nope. Remove the MCG from the map and add a FeatureGroup with the same markers to do achieve this.
Ok, thank you for your quick response, I appreciate it!
Here's another vote for a parameter to set minimum number of markers to form a cluster. Perhaps as an option to set when the cluster in instantiated?
I'm using your markerCluster for the first time and it's very impressive. Nice bit of work! Thanks.
Not sure how well this helps your guy's problems, but maxClusterRadius option set pretty low will prevent a lot of clusters from occurring and instead set smaller clusters.
Love the clustering UI-- but I'm having the same issue as Ethan925. As the PM, I'd like to set a minimum number of items that form a cluster, so that any set of 5 or fewer items don't cluster. I'm not sure if using a fixed number or perhaps a minimum distance to determine when a cluster forms makes more sense...
:+1: for both options. Set a minimum number of markers and the posibility to toggle clustering with a function :-D
-
No clustering if less than X markers in it: similar to #499 (based on total markers in visible bounds) and #392 (but more about dynamic option change)
-
Toggle clustering on/off: similar to #552 and #534. The current solution for this is to switch between a MCG and a standard layer/featureGroup. However if it were built in MCG, it could benefit from its awesome animation and functionality to remove markers outside view port (even though this should be straight forward to port into a featureGroup, if not already done).
:+1: for no clustering below a certain number of markers!
:+1: (bookmarking this issue)
i think the maxClusterRadius will work pretty well . you should have a function that return the zoom level and another function that changes the maxClusterRadius according to zoom level. so with zoom level increase you should decrease the cluster radius to your preference .
Hi, I have a question about mavrkercluster, which by the way is just amazing :-)
I have two things I would like to achieve:
-
I have some data with people but I want to make sure that I don´t expose anyone´s home on the map as I have actual LongLat, My ideal would be to have a min cluster size say 5 so clusters always contain 5 elements and never become markers.
-
The second one is more a feature suggestions. I would be very cool if the clusters were formed by data that belong together in a shape (for example post nr shape, or commune, or city) Then the cluster were formed based on the data in your results, a good example could be car manufacture, so in one post area you would have clusters forming based on the shape (in this case a particular post number) and then a cluster for each brand of car in different colors and when you get down to markers a marker for each brand of car in the color of the cluster or as an actual car brand icon/image
OK first one is a problem for me right now I need to solve, the second would be so awesome :-D
i think the maxClusterRadius will work pretty well . you should have a function that return the zoom level and another function that changes the maxClusterRadius according to zoom level. so with zoom level increase you should decrease the cluster radius to your preference .
That is exactly the inverse what I personally want to achieve - I want to only have "worthwhile" clusters beyond a certain size - decreasing the maxClusterRadius would create even more smaller clusters ^^
Still interested in disabling clustering below a certain number of markers.
I'm also interested if possible in not clustering markers that are on the exact same position, or seeing them as only one marker.