greatCircle
描述
¥Description
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? | 对象 | line feature properties (default ) |
options.npoints? | number | number of points (default 100) |
options.offset? | number | offset controls the likelyhood that lines will be split which cross the dateline.The higher the number the more likely.(默认 10) |
返回
¥Returns
特性<LineString | MultiLineString> great circle line feature
¥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(...);