Takes a line and returns a line at offset by the specified distance.
npm install @turf/line-offsetTakes a [line][1] and returns a [line][1] at offset by the specified distance.
* geojson ([Geometry][2] | [Feature][3]<([LineString][1] | [MultiLineString][4])>) input GeoJSON
* distance [number][5] distance to offset the line (can be of negative value)
* options [Object][6] Optional parameters (optional, default {})
* options.units Units Supports all valid Turf [Units][7]. (optional, default 'kilometers')
``javascript
var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]], { "stroke": "#F00" });
var offsetLine = turf.lineOffset(line, 2, {units: 'miles'});
//addToMap
var addToMap = [offsetLine, line]
offsetLine.properties.stroke = "#00F"
`
Returns [Feature][3]<([LineString][1] | [MultiLineString][4])> Line offset from the input line
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.4
[2]: https://tools.ietf.org/html/rfc7946#section-3.1
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
[4]: https://tools.ietf.org/html/rfc7946#section-3.1.5
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[7]: https://turfjs.org/docs/api/types/Units
---
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
`sh`
$ npm install @turf/line-offset
Or install the all-encompassing @turf/turf module that includes all modules as functions:
`sh``
$ npm install @turf/turf