Skip to content

KBE3D / KBCore / turf / polygons

函数: polygons()

polygons<P>(coordinates: Position[][][], properties?: P, options?: { bbox?: BBox; id?: Id; }): FeatureCollection<Polygon, P>

Function

Creates a Polygon FeatureCollection from an Array of Polygon coordinates.

类型参数

P

P extends GeoJsonProperties = GeoJsonProperties

参数

coordinates

Position[][][]

an array of Polygon coordinates

properties?

P

an Object of key-value pairs to add as properties

options?

Optional Parameters

bbox?

BBox

Bounding Box Array [west, south, east, north] associated with the Feature

id?

Id

Identifier associated with the FeatureCollection

返回

FeatureCollection<Polygon, P>

Polygon FeatureCollection

示例

ts
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

KBE3D @3.0.0 Copyright © 2024-present KBE3D