问题
How can we calculate the number of those markers shown on the visible region only on google maps android?
回答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. :-)
来源:https://stackoverflow.com/questions/38896671/getting-number-of-markers-of-visible-region-of-google-maps-android