如何根据给定距离(以公里为单位)从经度和纬度的另一个城市过滤给定的经度和纬度城市列表。过滤城市的经纬度与其他城市的距离(经纬度)?
我想使用Google Maps API(javascript)或其他适合的解决方案。
cities = {
['zürich','47.368650', '8.539183'],
['City2','21.568650', '2.439183'],
['City3','41.568650', '4.439183']
}
distance = 2; //2 km
targetCity = ['zürich','47.368650', '8.539183'];
需要:getNearCities(targetCity,distance,cities);
谢谢
你可以看到这个页面http://www.movable-type.co.uk/scripts/latlong上haversine公式。 html –
查看google距离矩阵api https://developers.google.com/maps/documentation/distancematrix/ – Ronin