获取 google 地图 android 可见区域的标记数
Getting Number of Markers of visible region of google maps android
我们如何计算仅在 google 地图 android 的可见区域中显示的那些标记的数量?
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。 :-)
我们如何计算仅在 google 地图 android 的可见区域中显示的那些标记的数量?
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。 :-)