Skip to main content
Version: 7.1.0

lineOffset

Description

Takes a line and returns a line at offset by the specified distance.

Parameters

NameTypeDescription
geojsonGeometry | Feature<LineString | MultiLineString>input GeoJSON
distancenumberdistance to offset the line (can be of negative value)
options?ObjectOptional parameters (default {})
options.units?stringcan be degrees, radians, miles, kilometers, inches, yards, meters (default 'kilometers')

Returns

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(...);