lineOffset
Description
Takes a line and returns a line at offset by the specified distance.
Parameters
Name | Type | Description |
---|---|---|
geojson | Geometry | Feature<LineString | MultiLineString> | input GeoJSON |
distance | number | distance to offset the line (can be of negative value) |
options? | Object | Optional parameters (default {}) |
options.units? | string | can be degrees, radians, miles, kilometers, inches, yards, meters (default 'kilometers') |
Returns
Feature<LineString | MultiLineString> Line offset from the input line
Examples
var line = turf.lineString(
[
[-83, 30],
[-84, 36],
[-78, 41],
],
{ stroke: "#F00" },
);
var offsetLine = turf.lineOffset(line, 2, { units: "miles" });
Installation
$ npm install @turf/line-offset
import { lineOffset } from "@turf/line-offset";
const result = lineOffset(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.lineOffset(...);