Getting Number of Markers of visible region of google maps android

喜你入骨 提交于 2019-12-13 07:11:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!