# lineOffset

Takes a line and returns a line at offset by the specified distance.
获取一条线并返回具有指定距离偏移量的线。

参数

参数 类型 描述
geojson (Geometry|Feature <(LineString|MultiLineString)>) input GeoJSON
distance number distance to offset the line (can be of negative value)
options Object Optional parameters: see below

options选项

属性 类型 默认值 描述
units string kilometers can be degrees, radians, miles, kilometers, inches, yards, meters

返回

Feature <(LineString|MultiLineString)> - Line offset from the input line

示例

var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]], { "stroke": "#F00" });

var offsetLine = turf.lineOffset(line, 2, {units: 'miles'});
Last Updated: 1/19/2021, 10:59:20 AM