以经纬度为参照物计算指定角度、距离的终点

接收入参的点作为参照物,通过指定单位的距离计算出目标点的位置

若以 degress 为单位,将使用 Haversine 公式说明整体曲率

参数

入参类型描述
originCoord | GeoJSON起始点,即参照物
distanceNumber和起始点的距离
bearingNumber介于 -180 至 180 之间
optionsObject可配置项

options

属性类型默认值描述
unitsString"kilometers"单位,可选的有 degrees、radians、miles、kilometers
propertiesObject{}出参 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);
Last Updated:
Contributors: 小小志