Problem/Motivation
MarkerClusterer has additional options available that are not exposed in the UI. These have useful effects on the clustering behaviour. The available options are outlined in the reference docs as follows:
gridSize, number - The grid size of a cluster in pixels.
maxZoom, number - The maximum zoom level that a marker can be part of a cluster.
zoomOnClick, boolean - Whether the default behaviour of clicking on a cluster is to zoom into it.
averageCenter, boolean - Whether the center of each cluster should be the average of all markers in the cluster.
minimumClusterSize, number - The minimum number of markers to be in a cluster before the markers are hidden and a count is shown.
styles, object - An object that has style properties.
Of these options, only styles is currently exposed in the views plugin UI. It would be useful to expose some or all of the additional settings in the UI as the clustering out of the box uses a moderately large grid size (60px) meaning that clustering can make the map appear somewhat sparsely populated.
Proposed resolution
Expose additional MarkerClusterer settings in the UI and modify the JavaScript to pass these options when creating the MarkerClusterer. At the very least, we should add minimumClusterSize and gridSize
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3035006-5-marker-clusterer-options-v2.patch | 4.76 KB | christianadamski |
| #5 | 3035006-5-marker-clusterer-options-v2.patch | 4.76 KB | christianadamski |
| #2 | 3035006-02-expose-markerclusterer-options.patch | 9.57 KB | alanhdev |
Comments
Comment #2
alanhdev commentedThe attached patch was created against the 8.x-1.x branch. It adds new fields to the markerclusterer options in the views style plugin. The options are passed to the MarkerClusterer via drupalSettings and the defaults used are those contained in the MarkerClusterer reference docs.
Comment #3
alanhdev commentedComment #4
alanhdev commentedComment #5
christianadamski commentedI do not wish to add more features to 1.x. But I did adapt your work to 2.x.
Comment #6
christianadamski commentedForce 8.x-2.x
Comment #8
christianadamski commented