i'm using MarkerManager v3 and google maps to display with a lot of markers. Now everything works perfect, but I can't seem to find a way to show only the markers that the markermanager is showing. I am aware of the method getMarkerCount which returns the number of visible markers in the zoom, but I need the information from the markers like id, title etc. to update an table containing points on dragend-event.
I tried
google.maps.event.addListener(map, "dragend", function() {
for(var i = gMarkers.length, bounds = map.getBounds(); i--;) {
if( bounds.contains(gMarkers[i].getPosition()) ){
console.log(gMarkers[i].getVisible());
}
}
});
This method returns all markers even though they are not visible at the current zoom-level? Any idea of how I can achieve this?
To be more precise, see my test-site http://frankmyhre.dk/mapping/test.php, where the table should reflect the markers visible (red icon) on the map within the bounds
I consider my solution as being "quick and dirty". I think it should be doable, by using the plugin.
Anyway, the result is what you required, I think. The code I show is inside initialize; 1 extra function and a replacement of zoom_changed and dragend
Feel free to tamper with that 400ms delay in the setTimeout; set it to whatever suits you. Especially when you have hundreds of markers. No idea how slow this would get.