Appearance
KBE3D / KBCore / turf / lineOffset
函数: lineOffset()
lineOffset<
T>(geojson:T|Feature<T,GeoJsonProperties>,distance:number,options?: {units?:Units; }):Feature<T>
Function
Takes a line and returns a line at offset by the specified distance.
类型参数
T
T extends LineString | MultiLineString
参数
geojson
input GeoJSON
T | Feature<T, GeoJsonProperties>
distance
number
distance to offset the line (can be of negative value)
options?
Optional parameters
units?
Supports all valid Turf Units.
返回
Feature<T>
Line offset from the input line
示例
ts
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"