Skip to content
This repository has been archived by the owner on Jun 16, 2019. It is now read-only.

clustering not working on zoomout #149

Open
sunderkasajal1203 opened this issue Jun 21, 2018 · 0 comments
Open

clustering not working on zoomout #149

sunderkasajal1203 opened this issue Jun 21, 2018 · 0 comments

Comments

@sunderkasajal1203
Copy link

sunderkasajal1203 commented Jun 21, 2018

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);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant