EarthSDK
    正在准备搜索索引...

    函数 geoHeading

    • 计算两个点之间的方位角,采用球模型。

      该函数使用 @turf/bearing 库来计算从起点到终点的方位角。方位角的取值范围是 0 到 360 度。

      参数

      • p0: ESJVector3D

        起点的三维向量坐标。这个参数代表了起始点的位置信息。

      • p1: ESJVector3D

        终点的三维向量坐标。此参数表示了目标点的位置信息。

      返回 number

      从起点到终点的方位角,取值范围在 0 - 360 度之间。

      该函数依赖于 @turf/bearing@turf/helpers 库。@turf/bearing 用于计算方位角, @turf/helpers 中的 point 函数用于将 ESJVector3D 类型的坐标转换为 turf 库所需的点对象。

      import { ESJVector3D } from '../../ESJTypes';
      import { geoHeading } from './geoHeading';

      const startPoint: ESJVector3D = [0, 0, 0];
      const endPoint: ESJVector3D = [1, 1, 0];
      const heading = geoHeading(startPoint, endPoint);
      console.log(heading); // 输出计算得到的方位角