polygons
描述
¥Description
根据多边形坐标数组创建 多边形 FeatureCollection。
¥Creates a Polygon FeatureCollection from an Array of Polygon coordinates.
参数
¥Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| coordinates | UNCERTAIN | |
| properties? | GeoJsonProperties | 要添加为属性的键值对对象(默认 ) |
| options? | 对象 | 可选参数(默认值:) |
| options.bbox? | BBox | 与要素关联的边界框数组 [西,南,东,北] |
| options.id? | ID | 与特性集合关联的标识符 |
返回
¥Returns
FeatureCollection<多边形, GeoJsonProperties> 多边形要素集合
¥FeatureCollection<Polygon, GeoJsonProperties> Polygon FeatureCollection
示例
¥Examples
var polygons = turf.polygons([
[
[
[-5, 52],
[-4, 56],
[-2, 51],
[-7, 54],
[-5, 52],
],
],
[
[
[-15, 42],
[-14, 46],
[-12, 41],
[-17, 44],
[-15, 42],
],
],
]);
//=polygons
安装
¥Installation
$ npm install @turf/helpers
import { polygons } from "@turf/helpers";
const result = polygons(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.polygons(...);