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

Comments

Alan-H created an issue. See original summary.

alanhdev’s picture

Issue summary: View changes
StatusFileSize
new9.57 KB

The 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.

alanhdev’s picture

Issue summary: View changes
Status: Active » Needs review
alanhdev’s picture

Assigned: alanhdev » Unassigned
christianadamski’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
StatusFileSize
new4.76 KB

I do not wish to add more features to 1.x. But I did adapt your work to 2.x.

christianadamski’s picture

Force 8.x-2.x

  • Alan-H authored b5a3618 on 8.x-2.x
    Issue #3035006 by ChristianAdamski, Alan-H: Expose marker clusterer...
christianadamski’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.