【发布时间】:2021-06-29 07:49:07
【问题描述】:
我想根据点 A 的坐标以及与点 A 的距离和角度来获取点 B 的coordinate (x,y)使用 Arcgis js API 4.x。
例如:我在 (a,b) 中有点 A,A 和 B 之间的距离为 500m,角度为 20 °,我怎样才能得到 B 的 (x,y)。
【问题讨论】:
标签: javascript gis arcgis-js-api
我想根据点 A 的坐标以及与点 A 的距离和角度来获取点 B 的coordinate (x,y)使用 Arcgis js API 4.x。
例如:我在 (a,b) 中有点 A,A 和 B 之间的距离为 500m,角度为 20 °,我怎样才能得到 B 的 (x,y)。
【问题讨论】:
标签: javascript gis arcgis-js-api
我找到了公式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
【讨论】: