找到所有的标记给定半径内 [英] Finding all the markers inside a given radius
问题描述
输入:给定一个特定的坐标(纬度和经度)和半径 输出:显示所有驻留在从标记给出列表圈子标记
Input: Given a specific co-ordinate (latitude and longitude) and radius Output: Displaying all the markers which reside under that circle from given list of markers.
我怎样才能做到这一点在谷歌地图?
How can I do this in google maps?
推荐答案
只是遍历所有你必须标记和使用下面的函数来获得具体的坐标来标记的距离: computeDistanceBetween ()
:
Just iterate all the markers you have and use the following function to get the distance from the specific co-ordinate to the marker: computeDistanceBetween()
:
要计算这个距离,调用computeDistanceBetween(),它传递 2 LatLng对象。
To compute this distance, call computeDistanceBetween(), passing it two LatLng objects.
我发现它在这里。然后,只需过滤掉一切变成是足够接近的标志。
I found it over here. Then just filter out all the markers that turn out to be close enough.
这篇关于找到所有的标记给定半径内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!