@turf/line-offset v7.2.0
@turf/line-offset
lineOffset
Takes a line and returns a line at offset by the specified distance.
Parameters
geojson
(Geometry | Feature<(LineString | MultiLineString)>) input GeoJSONdistance
number distance to offset the line (can be of negative value)options
Object Optional parameters (optional, default{}
)options.units
string can be degrees, radians, miles, kilometers, inches, yards, meters (optional, default'kilometers'
)
Examples
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<(LineString | MultiLineString)> Line offset from the input line
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.
Installation
Install this module individually:
$ npm install @turf/line-offset
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
6 months ago
10 months ago
10 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago