googlearchive/js-marker-clusterer

clustering not working on zoomout

sunderkasajal1203 opened this issue · 0 comments

The total data that needs to be renderd is 100000. I am sending data in patches of 10000 and concating it to display a final single cluster of 100000 markers which works correctly. But after zoomin when i click on zoomout it again forms patches of 10000 each on every zoom_changed event and overlaps by forming clusters of 10000 each instead of forming one single cluster.

//This is the code//
var mapDiv = document.getElementById('newmap');
map = new google.maps.Map(mapDiv, {
center: new google.maps.LatLng(latitude, longitude),
zoom: zoom,
panControl: true,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
zoomControl: true,
zoomControlOptions:
{
position: google.maps.ControlPosition.LEFT_TOP,

         },
        streetViewControl: true,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });

var new_arr=new Array();
function addMarker1(locations,outletname,outletData)
{
var markers1 = locations.map(function(location, i)
{
return new google.maps.Marker
({
position: location,
});
});

              var markerCluster = new MarkerClusterer(map, new_arr,{imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
              new_arr=new_arr.concat(markers1);
              markerCluster.resetViewport();
              markerCluster.clearMarkers();
              markers = [];
              markerCluster.removeMarker(new_arr);
              markerCluster.addMarkers(new_arr);
              markerCluster.redraw();

}
// this is sending location in patches of 10000 each//
addMarker1(j,outletname,outletData);