Skip to main content
Version: Next

polygon

Description

Creates a Polygon Feature from an Array of LinearRings.

Parameters

NameTypeDescription
coordinatesArray<Array<Array<number>>>an array of LinearRings
properties?Objectan Object of key-value pairs to add as properties (default {})
options?ObjectOptional Parameters (default {})
options.bbox?Array<number>Bounding Box Array [west, south, east, north] associated with the Feature
options.id?string | numberIdentifier 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(...);