Skip to main content
Version: 7.3.0

polygons

描述

🌐 Description

从多边形坐标数组创建一个 Polygon FeatureCollection

🌐 Creates a Polygon FeatureCollection from an Array of Polygon coordinates.

参数

🌐 Parameters

名称类型描述
coordinates不确定
properties?GeoJsonProperties一个键值对对象,用作要添加的属性 (默认 {})
options?Object可选参数 (默认 {})
options.bbox?BBox与要素相关的边界框数组 [西, 南, 东, 北]
options.id?Id与 FeatureCollection 关联的标识符

返回

🌐 Returns

FeatureCollection<Polygon, GeoJsonProperties> 多边形要素集合

示例

🌐 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(...);