根据距离和方向创建坐标

Create coordinate based on distance and direction

所以我有坐标 (A) 和 x 经度和 y 纬度。我想要的是根据用户输入创建新坐标 (B),其中坐标和方向 (0 - 360) 之间的距离(米)。什么公式可以实现?

到目前为止,我所做的是使用 answer1 and answer2

中的公式
new_latitude  = latitude  + (dy / r_earth) * (180 / pi);
new_longitude = longitude + (dx / r_earth) * (180 / pi) / cos(latitude * pi/180);

但它只是创建一个方向的新坐标,我想要的是方向可以改变。

您可以使用 this excellent site 中的公式(给定距起点的距离和方位角的目的地部分)

var φ2 = Math.asin( Math.sin(φ1)*Math.cos(d/R) +
                    Math.cos(φ1)*Math.sin(d/R)*Math.cos(brng) );
var λ2 = λ1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(φ1),
                         Math.cos(d/R)-Math.sin(φ1)*Math.sin(φ2));

其中φ为纬度,λ为经度,θ为方位(从北顺时针方向),δ为angular距离d/R; d是行进的距离,R是地球的半径