destination
描述
🌐 Description
以一个点为起点,计算在给定的距离(以度、弧度、英里或公里为单位)和方位角(以度为单位)的情况下的目标点位置。 这使用哈弗辛公式来考虑地球的曲率。
🌐 Takes a Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the Haversine formula to account for global curvature.
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| origin | Coord | 起点 |
| distance | number | 与原点的距离 |
| bearing | number | 范围从-180到180 |
| options? | Object | 可选参数 (默认 {}) |
| options.units? | Units | 支持所有有效的 Turf 单位 (默认 '公里') |
| options.properties? | Object | 将属性转换为 Point (默认 {}) |
返回
🌐 Returns
示例
🌐 Examples
var point = turf.point([-75.343, 39.984]);
var distance = 50;
var bearing = 90;
var options = { units: "miles" };
var destination = turf.destination(point, distance, bearing, options);
安装
🌐 Installation
$ npm install @turf/destination
import { destination } from "@turf/destination";
const result = destination(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.destination(...);