Search code examples
javascriptjquerygoogle-mapsgoogle-maps-api-3jquery-plugins

how to make the map clusters larger distance in less dense area in map instead of showing markers


I am using google map(clustering version) from the following link:

google map clusterer

everything is good and for example when I have 1000 location it clusters them but when I have 200 location and density is not high it does not clusters. I want to clusters even those that are not dense what should I do? is there anyway that I can change level of sensitivity of this google map to distance and zoom to be able to cluster even markers in a less dense area?


Solution

  • As you figured out which parameters to use with the above comments, here is how to pass these params to your marker cluster constructor:

    var mcOptions = {
        gridSize: 50,
        minimumClusterSize: 10
    };
    
    var markerCluster = new MarkerClusterer(map, markers, mcOptions);
    

    Where map is your map object and markers is your markers array. The numbers used are only for example. You have to play with these to get the desired results. Hope this helps.