Google maps performance with 2000 markers -


i have displaying 2000 markers on google maps. notice performance little slow. not sure about... it slow because if number of markers added map or visibility? how improve performance? can add them map , "hide" markers outside of bounds? or not because though not visible, added map? data show markers in list called var datapoints = [...].

my code add markers this:

for (i = 0; < markers.length; i++) {     var data = markers[i]     var mylatlng = new google.maps.latlng(data.lat, data.lng);     var marker = new google.maps.marker({         position: mylatlng,         map: map,         title: data.title     });     (function (marker, data) {         google.maps.event.addlistener(marker, "click", function (e) {             infowindow.setcontent(data.description);             infowindow.open(map, marker);         });     })(marker, data); } 

any optimization recommendations appreciated!

you have few options here. google's docs suggest either limiting visible markers current viewport, clustering (distance or grid based), or fusion tables. i've implemented google maps customization of markerclusterer module works quite large amounts of markers on 1 map. best of luck!


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -