在特定经纬度范围内搜索10公里范围内的经度/纬度 [英] Search for Longitude/latitude within 10 km Range From Specific Long-lat

查看:179
本文介绍了在特定经纬度范围内搜索10公里范围内的经度/纬度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从表中搜索所有位置,我要插入lon-lat是什么.
我想要一个在10公里范围内的所有位置的列表.

I Want To Search all Location from my table, What m I insert lon-lat.
i Want a List of All location within 10 km Range.

推荐答案

我认为您想考虑使用Haversine公式,有两个链接:

http://en.wikipedia.org/wiki/Haversine_formula [ http://www.yourhomenow.com/house/haversine.html [
I think you want to consider the use of the Haversine formula, a couple of links:

http://en.wikipedia.org/wiki/Haversine_formula[^]

and some code examples here:

http://www.yourhomenow.com/house/haversine.html[^]

Cheers


您有多种选择来计算两个点(纬度/经度)之间的距离:
1.使用如上所述的Haversine公式
2.余弦的球形定律
3.使用Google API的Geometry.Spherical.computeDistanceBetween()静态方法.

获取数组中的距离,并按距离升序对Array进行排序.忽略超过10公里的物品.
以上任何一种都可以用来计算距离.由于具有复杂的公式,使用Haversine可能会有点复杂,我将使用google computeDistanceBetween()方法,该方法简单易实现.

此处详细显示了每个实现.
两点之间的距离(纬度/经度)
You have multiple options to calculate distance between two points(lat/long):
1. Using Haversine formula like mentioned above
2. Spherical Law of Cosines
3. using Google API''s Geometry.Spherical.computeDistanceBetween() static method.

Get the distance in array and sort Array by distance ascending order. ignore the items more than 10 km.
Any of above can be used to calculate distance. Using Haversine might be little complicated due to the complex formula, I will go for google computeDistanceBetween() method, its simple and easy to implement.

Implementation for each is shown here in detail Distance between two points(lat/lang)


这篇关于在特定经纬度范围内搜索10公里范围内的经度/纬度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆