Skip to content

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?

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"

KBE3D @3.0.0 Copyright © 2024-present KBE3D