以经纬度为参照物计算指定角度、距离的终点
接收入参的点作为参照物,通过指定单位的距离计算出目标点的位置
若以 degress 为单位,将使用 Haversine 公式说明整体曲率
参数
| 入参 | 类型 | 描述 |
|---|---|---|
| origin | Coord | GeoJSON | 起始点,即参照物 |
| distance | Number | 和起始点的距离 |
| bearing | Number | 介于 -180 至 180 之间 |
| options | Object | 可配置项 |
options
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| units | String | "kilometers" | 单位,可选的有 degrees、radians、miles、kilometers |
| properties | Object | {} | 出参 type 为 Point 的 GeoJSON 的 properties 属性 |
使用示例
const point = {
type: "Feature",
properties: {},
geometry: {
coordinates: [88.90624999999949, 20.46818922264039],
type: "Point",
},
};
const endPoint = hnSdk.calcDestination(point, 1000, 45, {
units: "kilometers",
});
const geojsonLayer = hnSdk.geoJSON(endPoint).addTo(map);
