例如: 可以说,地球地图上有某种直墙,我们知道其起点和终点的经/纬坐标:
wall.start.lat, wall.start.lon
wall.end.lat, wall.end.lon
此外,我们还有某种对象:
object.lat
object.lon
如果我要从该对象走到该表面上的墙,我需要找到最靠近该对象的墙。
在飞机上解决起来很容易,但是我坚持使用球体。
答案 0 :(得分:1)
I’ve sometimes been asked about distance of a point from a great-circle path (sometimes called cross track error).
Formula: dxt = asin( sin(δ13) ⋅ sin(θ13−θ12) ) ⋅ R
where δ13 is (angular) distance from start point to third point
θ13 is (initial) bearing from start point to third point
θ12 is (initial) bearing from start point to end point
R is the earth’s radius
JavaScript:
var δ13 = d13 / R;
var dXt = Math.asin(Math.sin(δ13)*Math.sin(θ13-θ12)) * R;
Here, the great-circle path is identified by a start point and an end point – depending on what initial data you’re working from, you can use the formulas above to obtain the relevant distance and bearings. The sign of dxt tells you which side of the path the third point is on.
The along-track distance, from the start point to the closest point on the path to the third point, is
Formula: dat = acos( cos(δ13) / cos(δxt) ) ⋅ R
where δ13 is (angular) distance from start point to third point
δxt is (angular) cross-track distance
R is the earth’s radius
JavaScript:
var δ13 = d13 / R;
var dAt = Math.acos(Math.cos(δ13)/Math.cos(dXt/R)) * R;
并应用给定目标点的距离和距起始点的方位方法来获取点坐标
答案 1 :(得分:0)
我会
您还需要在目标点和线段端点之间找到距离,以防距离变近。