lineString
描述
¥Description
根据位置数组创建 LineString 特性。
¥Creates a LineString Feature from an Array of Positions.
参数
¥Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| coordinates | 数组<位置> | 位置数组 |
| properties? | GeoJsonProperties | 要添加为属性的键值对对象(默认 ) |
| options? | 对象 | 可选参数(默认值:) |
| options.bbox? | BBox | 与要素关联的边界框数组 [西,南,东,北] |
| options.id? | ID | 与特性关联的标识符 |
返回
¥Returns
特性<LineString, GeoJsonProperties> 线串要素
¥Feature<LineString, GeoJsonProperties> LineString Feature
示例
¥Examples
var linestring1 = turf.lineString(
[
[-24, 63],
[-23, 60],
[-25, 65],
[-20, 69],
],
{ name: "line 1" },
);
var linestring2 = turf.lineString(
[
[-14, 43],
[-13, 40],
[-15, 45],
[-10, 49],
],
{ name: "line 2" },
);
//=linestring1
//=linestring2
安装
¥Installation
$ npm install @turf/helpers
import { lineString } from "@turf/helpers";
const result = lineString(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.lineString(...);