# 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 可选参数:见下文

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: 6/21/2023, 11:40:17 PM