在arcgis js中通过当前点坐标、角度和距离获取新点坐标api 4.x

Get new point coordinate by current Point coordinate, angle and distance in arcgis js api 4.x

我想根据点 A 的坐标和点 B 的坐标以及与点 的距离得到 coordinate (x,y) =20=]A 和使用 Arcgis js 的角度 API 4.x .

例如:我在 (a,b) 中有点 A AB 是 500m,角度是 20°,我如何得到 B.

的 (x,y)

我找到了等式 here,我实现了它,而且效果很好。

这是我的简单:

    const R = 6371e3; //rayon of the erth
    let lat1 = 36.7538 * Math.PI / 180; // latitude in rad
    let long1 = 3.0588 * Math.PI / 180; // longiture in rad
    let d = 5000; //distance between the two points
    let angle = (90-20)*Math.PI/180; // the angle between the 2 points in rad (20°)
    const sigma = d / R;
    const delLat = sigma * Math.cos(angle);
    let lat2 = (lat1 + delLat) * 180 / Math.PI;//latitude of the destination point
    const del = Math.log(Math.tan(lat2 / 2 + Math.PI / 4) / Math.tan(lat1 / 2 + Math.PI / 4));
    // const q = Math.abs(del) > 10e-12 ? delLat / del : Math.cos(lat1); 
    const q = Math.cos(lat1)
    
    const delLong = sigma * Math.sin(angle) / q;
    let long2 = (long1 + delLong) * 180 / Math.PI; //longitude of the destination point