我们如何计算仅在google maps android上显示在可见区域上的那些标记的数量?
答案 0 :(得分:2)
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++;
}
}
下次尝试提供Minimal, Complete, and Verifiable example。 : - )