计算 3D (NED) 地理坐标(纬度、经度、深度)之间的距离

Calculate Distance Between 3D (NED) Geographic Coordinates (Lat, Long, Depth)

众所周知,Haversine formula 是计算地理坐标之间距离的有用机制。显然,R 中的某些包需要提供者进一步改进;考虑到地球的椭圆体性质。

然而,我找不到任何方法来找到NED coordinates之间的直线距离:即纬度,经度和深度.

这种类型的距离计算对于研究发生在海洋深处或一般地壳下的事件至关重要。

有人知道一种方法可以帮助在球体上进行此类距离计算吗?在地球上?如果没有,有人知道解决此问题的最佳三角函数方法是什么吗?

线性距离在笛卡尔坐标系中更容易计算,因此第一步是将 NED 坐标(即长-纬-高)坐标转换为此类系统。在开源世界中,PROJ4 的 "geocent" 投影是一个不错的选择,它以米为单位给出正交 x-y-z 坐标系中的位置。

Simon Urbanek 的 proj4 包提供了一种很好的轻量级方法来完成这种转换。为了演示它的用途,我将编写一个小包装函数,它在 NED 坐标中获取两个点并计算它们以米为单位的间隔。 (一个复杂的问题是 ptransform() 需要其以弧度为单位的纬度和经度坐标;因此在函数的第一行和第二行中除以 180/pi。)

library(proj4)
findDist <- function(x=c(0,0,0), y=c(0,0,0)) {
    x <- matrix(x/c(180/pi, 180/pi, 1), ncol=3)
    y <- matrix(y/c(180/pi, 180/pi, 1), ncol=3)
    xx <- ptransform(x, src.proj="+proj=longlat +ellps=WGS84",
                        dst.proj="+proj=geocent +ellps=WGS84")
    yy <- ptransform(y, src.proj="+proj=longlat +ellps=WGS84",
                        dst.proj="+proj=geocent +ellps=WGS84")
    sqrt(sum((yy-xx)^2))
}

## A sanity check. (Find distance between two points at 0°N 0°E, one on the
## surface and one 100m below the surface (i.e. at a height of -100m).)
findDist(c(0,0,0), c(0,0,-100))
## [1] 100

## Distance from North to South Pole
findDist(c(0,90,0), c(0,-90,0))
## [1] 12713505

## Diameter of the earth at its equator
findDist(c(0,0,0), c(180,0,0))
## [1] 12756274