Skip to main content
Version: Next

lineOffset

描述

¥Description

Takes a line and returns a line at offset by the specified distance.

参数

¥Parameters

名称类型描述
geojson几何图形 | 特性<LineString | MultiLineString>输入 GeoJSON
distancenumberdistance to offset the line (can be of negative value)
options?对象可选参数(默认
options.units?stringcan be degrees, radians, miles, kilometers, inches, yards, meters (default 'kilometers')

返回

¥Returns

特性<LineString | MultiLineString> Line offset from the input line

¥Feature<LineString | MultiLineString> Line offset from the input line

示例

¥Examples

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

var offsetLine = turf.lineOffset(line, 2, { units: "miles" });

安装

¥Installation

$ npm install @turf/line-offset

import { lineOffset } from "@turf/line-offset";
const result = lineOffset(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.lineOffset(...);