polygon
Description
Creates a Polygon Feature from an Array of LinearRings.
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 Feature |
Returns
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(...);