polygon
描述
¥Description
¥Creates a Polygon Feature from an Array of LinearRings.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
coordinates | UNCERTAIN | |
properties? | GeoJsonProperties | 一个 键值对对象,用于添加为属性(默认为 {}) |
options? | 对象 | 可选参数(默认 {}) |
options.bbox? | BBox | 与要素关联的边界框数组 [西,南,东,北] |
options.id? | ID | 与特性关联的标识符 |
返回
¥Returns
特性<多边形, GeoJsonProperties> 多边形特性
¥Feature<Polygon, GeoJsonProperties> Polygon Feature
示例
¥Examples
var polygon = turf.polygon(
[
[
[-5, 52],
[-4, 56],
[-2, 51],
[-7, 54],
[-5, 52],
],
],
{ name: "poly1" },
);
//=polygon
安装
¥Installation
$ npm install @turf/helpers
import { polygon } from "@turf/helpers";
const result = polygon(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.polygon(...);