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