Modify element ranges of MarkerClusterer v3 Gmap.js

2

Query: I need to modify the ranges of elements that are grouped in MarkerClusterer, so that when the color clusters appear (which in the end are images that I set myself), each one represents a number of elements determined by me, and not the one that comes by default with the API.

Greetings and I hope some answer !!!!

MarkerClusterer v3: link

    
asked by Felipe Parra Soto 15.11.2016 в 15:21
source

1 answer

0

If you look at the page you link, there is a drop-down list that allows you to change the size of the cluster (which seems to be what you want). The value of that list is passed to the gridSize parameter when the map is created / refreshed:

markerClusterer = new MarkerClusterer(map, markers, {
    maxZoom: zoom,
    gridSize: size, // ---------------- AQUI
    styles: styles[style],
    imagePath: '../images/m'
});

That property has its getter and setter to read and write the value ( getGridSize and setGridSize respectively).

Although looking at the documentation , it seems that minimumClusterSize is actually what you are searching. gridSize is used to indicate the size of the grid of a cluster in pixels, while minimumClusterSize is to indicate the minimum number of markers that will be in a cluster before they are hidden and the account is updated.

    
answered by 15.11.2016 в 17:45