Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can merge the Interface Renderer with the GridOptions gridSize within the configuration object for Google Maps markerClusterer using the following code:

// initialize your interface renderer and grid options
var interfaceRenderer = new MarkerClusterer.DefaultRenderer();
var gridOptions = {
    gridSize: 40,
    minClusterSize: 2,
    maxZoom: 12
};

// merge the interface renderer and grid options into the configuration object
var markerClustererOptions = {
    zoomOnClick: true,
    averageCenter: true,
    styles: [{
        textColor: 'white',
        textSize: 12,
        url: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'
    }],
    renderer: interfaceRenderer,
    gridSize: gridOptions.gridSize,
    minClusterSize: gridOptions.minClusterSize,
    maxZoom: gridOptions.maxZoom
};

In this example, we first initialize the interfaceRenderer and gridOptions objects. Then, we merge these objects into the markerClustererOptions configuration object using the gridOptions properties as needed. Finally, we can use this merged markerClustererOptions object when creating a new instance of the MarkerClusterer class.