polygons
Description
Creates a Polygon FeatureCollection from an Array of Polygon coordinates.
Parameters
Name | Type | Description |
---|---|---|
coordinates | UNCERTAIN | |
properties? | GeoJsonProperties | an Object of key-value pairs to add as properties (default {}) |
options? | Object | Optional Parameters (default {}) |
options.bbox? | BBox | Bounding Box Array [west, south, east, north] associated with the Feature |
options.id? | Id | Identifier associated with the FeatureCollection |
Returns
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(...);