Skip to content Skip to sidebar Skip to footer

Getting Number Of Markers Of Visible Region Of Google Maps Android

How can we calculate the number of those markers shown on the visible region only on google maps android?

Solution 1:

var markers; //your markers
var map; //your map
var countInBoundingBox = 0; //the counter for the markers in bounding box

for (var i = markers.length, bounds = map.getBounds(); i--;) {
  if (bounds.contains(markers[i].getPosition())) {
    countInBoundingBox++;
  }
}

Next time try to provide a Minimal, Complete, and Verifiable example. :-)


Post a Comment for "Getting Number Of Markers Of Visible Region Of Google Maps Android"