Search inside circle markers

两盒软妹~` 提交于 2019-12-11 18:08:10

问题


I need to do a search for markers that are within a circle using as parameters the radius and position of the center of the circle. Someone can help me on how serious this search.


回答1:


Concept:

  1. make an array of the markers you want to search
  2. iterate through the array of markers calculating the distance between each marker and the center point using the geometry library computeDistanceBetween() function
  3. compare that distance to the radius of the circle, if it is less than the radius, the marker is inside the circle, otherwise it is outside the circle.

example (with center point from geocoded address)



来源:https://stackoverflow.com/questions/11704148/search-inside-circle-markers

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