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
.
Parameters
Name | Type | Description |
---|---|---|
start | Coord | source point feature |
end | Coord | destination point feature |
options? | Object | Optional parameters (default {}) |
options.properties? | Object | 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. (default 10) |
Returns
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(...);