Haversine vs Equirectangular 逼近

Posted

技术标签:

【中文标题】Haversine vs Equirectangular 逼近【英文标题】:Haversine vs Equirectangular approximation 【发布时间】:2014-04-20 22:33:47 【问题描述】:

所以,我需要计算两点之间的距离(经纬对)。我在Movable Type Scripts 中读到过Haversine 公式和Equirectangular 近似。

由于我只想计算短距离(小于 4 KM),Equirectangular 公式是一个很好的近似值吗?

另外,我读过 mysql 数据库 in Google Developers documentation 中的经纬度存储,他们实现了像这样的 Haversine 公式:

SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;

我的最后一个问题是,过滤sql查询中的点(如示例中)和通过代码过滤它们之间是否存在很大的性能差异?。

【问题讨论】:

【参考方案1】:

当我在更远的距离(1000 公里,英国境内)测试半正弦 v equirectangular 时,差异约为 0.1%。因此,对于 4 公里或更短的距离,您最好使用 equirectangular 作为速度,除非您需要最大精度。

【讨论】:

以上是关于Haversine vs Equirectangular 逼近的主要内容,如果未能解决你的问题,请参考以下文章

为Haversine距离准备数据

MySQL存储函数中的Haversine

如何使用 Haversine 公式计算行驶距离(不是位移)?

如何在 ColdFusion 中锻炼 Haversine 公式

Haversine 公式 - 结果太高

Haversine 公式和 Python 3 - 数学域错误