如何从两个位置的经纬度找到距离? [英] How to find distance from the latitude and longitude of two locations?
问题描述
我有一组位置的纬度和经度.
I have a set of latitudes and longitudes of locations.
- 如何找到从集合中的一个位置到另一个位置的距离?
- 有公式吗?
推荐答案
Haversine 公式假设地球是球形的.然而,耳朵的形状更为复杂.扁球体模型会得到更好的结果.
The Haversine formula assumes a spherical earth. However, the shape of the earh is more complex. An oblate spheroid model will give better results.
如果需要这样的精度,最好使用Vincenty 逆公式.有关详细信息,请参阅 http://en.wikipedia.org/wiki/Vincenty's_formulae.使用它,您可以获得 0.5mm 的球体模型精度.
If such accuracy is needed, you should better use Vincenty inverse formula. See http://en.wikipedia.org/wiki/Vincenty's_formulae for details. Using it, you can get a 0.5mm accuracy for the spheroid model.
没有完美的公式,因为地球的真实形状太复杂,无法用公式表达.此外,地球的形状会因气候事件而发生变化(参见 http://www.nasa.gov/centers/goddard/earthandsun/earthshape.html),也会随着地球自转而随时间变化.
There is no perfect formula, since the real shape of the earth is too complex to be expressed by a formula. Moreover, the shape of earth changes due to climate events (see http://www.nasa.gov/centers/goddard/earthandsun/earthshape.html), and also changes over time due to the rotation of the earth.
您还应该注意,上述方法没有考虑高度,并且假设是海平面扁球体.
You should also note that the method above does not take altitudes into account, and assumes a sea-level oblate spheroid.
2010 年 7 月 10 日编辑:我发现在极少数情况下 Vincenty 逆公式不会收敛到声明的准确度.一个更好的主意是使用 GeographicLib(参见 http://sourceforge.net/projects/geographiclib/)这也更准确.
Edit 10-Jul-2010: I found out that there are rare situations for which Vincenty inverse formula does not converge to the declared accuracy. A better idea is to use GeographicLib (see http://sourceforge.net/projects/geographiclib/) which is also more accurate.
这篇关于如何从两个位置的经纬度找到距离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!