Skip to main content
Version: Next

polygon

Description

Creates a Polygon Feature from an Array of LinearRings.

Parameters

NameTypeDescription
coordinatesUNCERTAIN
properties?GeoJsonPropertiesan Object of key-value pairs to add as properties (default {})
options?ObjectOptional Parameters (default {})
options.bbox?BBoxBounding Box Array [west, south, east, north] associated with the Feature
options.id?IdIdentifier 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(...);