greatCircle
描述
🌐 Description
将大圆航线计算为 LineString 或 MultiLineString。
如果 start 和 end 点跨越了对跖线,生成的要素将被拆分为 MultiLineString。如果 start 和 end 位置相同,则会返回一个 LineString,其重复坐标的长度为 npoints 选项。
🌐 Calculate great circles routes as LineString or MultiLineString.
If the start and end points span the antimeridian, the resulting feature will
be split into a MultiLineString. If the start and end positions are the same
then a LineString will be returned with duplicate coordinates the length of the npoints option.
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| 开始 | 坐标 | 源点要素 |
| 结束 | Coord | 目的地点特性 |
| options? | 对象 | 可选参数 (默认 {}) |
| options.properties? | 对象 | 线要素属性 (默认 {}) |
| options.npoints? | 数字 | 点数 (默认 100) |
| options.offset? | 数字 | offset 控制跨越日期变更线的行被拆分的可能性。数值越高,可能性越大。(默认值 10) |
返回
🌐 Returns
Feature<LineString | MultiLineString> 大圆航线特性
示例
🌐 Examples
var start = turf.point([-122, 48]);
var end = turf.point([-77, 39]);
var greatCircle = turf.greatCircle(start, end, {
properties: { name: "Seattle to DC" },
});
安装
🌐 Installation
$ npm install @turf/great-circle
import { greatCircle } from "@turf/great-circle";
const result = greatCircle(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.greatCircle(...);