知道出发点和距离的第二点

ppp*_*cki 28 math trigonometry distance latitude-longitude

使用纬度和经度值(点A),我试图计算另一个点B,X米距离点A的0弧度.然后显示点B纬度和经度值.

示例(伪代码):

PointA_Lat = x.xxxx;
PointA_Lng = x.xxxx;
Distance = 3; //Meters
bearing = 0; //radians

new_PointB = PointA-Distance;
Run Code Online (Sandbox Code Playgroud)

我能够计算出两点之间的距离,但我想知道的是知道距离和方位的第二点.

最好是PHP或Javascript.

谢谢

Jim*_*wis 46

看起来你是以米为单位测量距离(R),从正东方向逆时针方向测量轴承(θ).为了您的目的(数米的数量),平面几何应该足够准确.在这种情况下,

dx = R*cos(theta) ; theta measured counterclockwise from due east
dy = R*sin(theta) ; dx, dy same units as R
Run Code Online (Sandbox Code Playgroud)

如果从正北方向顺时针测量θ(例如,罗盘方位),则dx和dy的计算略有不同:

dx = R*sin(theta)  ; theta measured clockwise from due north
dy = R*cos(theta)  ; dx, dy same units as R
Run Code Online (Sandbox Code Playgroud)

在任何一种情况下,经度和纬度的变化是:

delta_longitude = dx/(111320*cos(latitude))  ; dx, dy in meters
delta_latitude = dy/110540                   ; result in degrees long/lat
Run Code Online (Sandbox Code Playgroud)

常数110540和111320之间的差异是由于地球的扁率(极地和赤道周长不同).

这是一个有用的例子,使用你后来问题中的参数:

给定经度-87.62788度的起始位置,纬度41.88592度,从起始位置找到西北500米处的坐标.

如果我们从正东方向逆时针测量角度,"西北"对应于θ= 135度.R是500米.

dx = R*cos(theta) 
   = 500 * cos(135 deg) 
   = -353.55 meters

dy = R*sin(theta) 
   = 500 * sin(135 deg) 
   = +353.55 meters

delta_longitude = dx/(111320*cos(latitude)) 
                = -353.55/(111320*cos(41.88592 deg))
                = -.004266 deg (approx -15.36 arcsec)

delta_latitude = dy/110540
               = 353.55/110540
               =  .003198 deg (approx 11.51 arcsec)

Final longitude = start_longitude + delta_longitude
                = -87.62788 - .004266
                = -87.632146

Final latitude = start_latitude + delta_latitude
               = 41.88592 + .003198
               = 41.889118
Run Code Online (Sandbox Code Playgroud)

  • 110540和111320,这些数字来自哪里? (3认同)
  • @gfan:地球表面的 1 度纬度等于 110540 米。一经度等于 111320 米(在赤道)。它们是不同的,因为地球不是一个完美的球体。它在赤道向外凸出,因此赤道周长略大于极地周长。 (2认同)