lineString
Description
Creates a LineString Feature from an Array of Positions.
Parameters
Name | Type | Description |
---|---|---|
coordinates | Array<Position> | an array of Positions |
properties? | GeoJsonProperties | an Object of key-value pairs to add as properties (default {}) |
options? | Object | Optional Parameters (default {}) |
options.bbox? | BBox | Bounding Box Array [west, south, east, north] associated with the Feature |
options.id? | Id | Identifier associated with the Feature |
Returns
Feature<LineString, GeoJsonProperties> LineString Feature
Examples
var linestring1 = turf.lineString(
[
[-24, 63],
[-23, 60],
[-25, 65],
[-20, 69],
],
{ name: "line 1" },
);
var linestring2 = turf.lineString(
[
[-14, 43],
[-13, 40],
[-15, 45],
[-10, 49],
],
{ name: "line 2" },
);
//=linestring1
//=linestring2
Installation
$ npm install @turf/helpers
import { lineString } from "@turf/helpers";
const result = lineString(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.lineString(...);