Skip to main content
Version: 7.2.0

greatCircle

描述

¥Description

将大圆航线计算为 LineStringMultiLineString。如果 startend 点跨越对向子午线,则生成的要素将被拆分为 MultiLineString。如果 startend 位置相同,则将返回一个 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

名称类型描述
start坐标系源点要素
end坐标系目标点特性
options?对象可选参数(默认 {})
options.properties?对象线要素属性(默认值为 --- 左括号 ------ 右括号 ---)
options.npoints?number点数(默认值 100)
options.offset?number偏移量控制跨越日期变更线的线被分割的可能性。数字越大,可能性越大。(默认 10)

返回

¥Returns

特性<LineString | MultiLineString> 大圆线特性

¥Feature<LineString | MultiLineString> great circle line feature

示例

¥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(...);