Skip to content

KBE3D / KBCore / turf / greatCircle

函数: greatCircle()

greatCircle(start: Point | Position | Feature<Point, GeoJsonProperties>, end: Point | Position | Feature<Point, GeoJsonProperties>, options?: { properties?: GeoJsonProperties; npoints?: number; offset?: number; }): Feature<LineString | MultiLineString>

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.

参数

start

source point feature

Point | Position | Feature<Point, GeoJsonProperties>

end

destination point feature

Point | Position | Feature<Point, GeoJsonProperties>

options?

Optional parameters

properties?

GeoJsonProperties

line feature properties

npoints?

number

number of points

offset?

number

offset controls the likelyhood that lines will be split which cross the dateline. The higher the number the more likely.

返回

Feature<LineString | MultiLineString>

great circle line feature

Name

greatCircle

示例

ts
var start = turf.point([-122, 48]);
var end = turf.point([-77, 39]);

var greatCircle = turf.greatCircle(start, end, {properties: {name: 'Seattle to DC'}});

//addToMap
var addToMap = [start, end, greatCircle]

KBE3D @3.0.0 Copyright © 2024-present KBE3D