两个GEO位置之间的距离 [英] Distance Between Two GEO Locations

查看:133
本文介绍了两个GEO位置之间的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个GEO位置。如何计算它们之间的距离?

I have two GEO locations. How can I calculate the distance between them?

推荐答案

GPS坐标是WGS84球体上的地理坐标。在这个模型下,Vincenty的公式给出了亚毫米精度的结果。对于大多数应用来说,这可能是过度杀伤或实际欺骗,因为地球的表面没有被WGS84建模到那个等级。

GPS coordinates are geographical coordinates on the WGS84 spheroid. Under this model, Vincenty's formulae gives results of sub-millimeter accuracy. For most applications, that's either overkill or actually deceptive, as the earth's surface is not modelled by WGS84 to that scale.

你可以比较各种距离计算方法的准确性 此页 断开的链接;请查看源代码而不是)。正如您所看到的,球形和差分近似(后者使用具有正确局部度量的毕达哥拉斯定理)在很多情况下都是不准确的。

You can compare the accurracy of various methods of distance computation on this page (broken link; check the source code instead). As you can see, the spherical and the differential approximations (the latter uses the Pythagorean theorem with the correct local metric) are inaccurate for a lot of cases.

其余的方法,第一个使用球体的平均半径从地理纬度转换为地心纬度,而第二个使用余弦规则在小距离的情况下获得更准确的结果(其中'小'的定义主要取决于(纬度差异)。

Of the remaining methods, the first one uses the spheroid's mean radius to convert from geographical to geocentrical latitude, whereas the second one uses the cosine rule to get more accurate results in case of 'small' distances (where the definition of 'small' mainly depends on the difference in latitude).

仅包含这两种方法的单独脚本可以在这里找到,它提供了一个名为 distance()的函数,并期望有四个参数:两个纬度,经度差(全部以弧度表示)和一个布尔标志,表示距离是否为小。

A seperate script containing only these two methods can be found here, which provides a function called distance() and expecting four arguments: the two latitudes, the difference in longitude (all in radians) and a boolean flag indicating whether the distance is 'small'.

这篇关于两个GEO位置之间的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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