---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometry.Polygon.md
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/geometry.Polygon.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/dev/jsapi-v2-1/doc/en/llms.txt

# geometry.Polygon

Extends [IPolygonGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometry.md).

The "Polygon" geometry.

**See** [Polygon](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Polygon.md)

[Constructor](#constructor-summary) | [Fields](#properties-summary) | [Events](#events-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
geometry.Polygon([coordinates[, fillRule[, options]]])
```

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`coordinates`](#param-coordinates) | [] | Type: Number[][][]

Geometry coordinates. A three-dimensional array of elements that are each two-dimensional coordinates of the polygon contours. The first element describes the outer contour, and the rest describe the inner contours. ||
|| [`fillRule`](#param-fillRule) | "evenOdd" | Type: String

String ID that defines the polygon fill rule. Accepts one of two values: 
- evenOdd - Algorithm that checks whether a point is located in the fill area by drawing a ray from this point to infinity 	in any direction, and counting the number of contour segments in this shape that are crossed by this ray. If the number is odd, the point is inside it; if even, the point is outside it.
- nonZero - Algorithm that checks whether a point is located in the fill area by drawing a ray from this point to infinity 	in any direction, and checking the points at which a segment of the shape crosses this ray. Starting 	from zero, one is added each time a segment crosses the ray from left to right, and one is subtracted each time a segment 	crosses the ray from right to left. If the result equals zero, the point 	is inside the contour. Otherwise, it is outside it. ||
|| [`options`](#param-options) | — | Type: Object

Geometry options. ||
|| [`options.coordRendering`](#param-options.coordRendering) | "shortestPath" | Type: String

String ID defining the algorithm for recalculating geometry coordinates as pixel coordinates. Accepts one of two values: 
- shortestPath - Algorithm that considers projection cycling on the axes and generates pixel coordinates so that 	the distance between two neighboring points is minimal.
- straightPath - Algorithm that does not consider projection cycling. ||
|| [`options.geodesic`](#param-options.geodesic) | false | Type: Boolean

Enables display using geodesic lines. ||
|| [`options.pixelRendering`](#param-options.pixelRendering) | "jumpy" | Type: String

Method for calculating pixel coordinates of the shape in cycled projections. This option accepts one of the following values: 
- jumpy - The shape is placed as close as possible to the center of the map viewport, and can "jump" 	when the map is being moved.
- static - The shape is always located in the initial world and does not move when the map is moved. ||
|| [`options.projection`](#param-options.projection) | — | Type: [IProjection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|| [`options.simplification`](#param-options.simplification) | true | Type: Boolean

Enables simplification during rendering of a pixel geometry. ||
|#


**Example:**

```javascript
// Creating an instance of the polygon geometry (specifying coordinates of vertexes on contours).
var polygonGeometry = new ymaps.geometry.Polygon([
    // Outer contour.
    [
        [0, 0], [0, 5], [5, 5], [5, 0], [0, 0]
    ],
    // Inner contour.
    [
        [1, 1], [1, 2], [2, 2], [2, 1], [1, 1]
    ]
]);
// Creating a geo object instance and passing our geometry to the constructor.
var polygonGeoObject = new ymaps.GeoObject({ geometry: polygonGeometry });

// You can also access polygonGeometry via polygonGeoObject.geometry.
```

## Fields {#properties-summary}

#|
|| **Name** | **Type** | **Description** ||
|| [events](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events) | [IEventManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventManager.md)| Event manager.

Inherited from [IEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events). ||
|| [options](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options) | [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md)| Options manager.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options). ||
|#

## Events {#events-summary}

#|
|| **Name** | **Description** ||
|| [change](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#event-change)| Changed coordinates. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- oldCoordinates - Old coordinates
- newCoordinates - New coordinates.
- oldFillRule - Old fill rule.
- newFillRule - New fill rule.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#event-change). ||
|| [mapchange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#event-mapchange)| Map reference changed. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- oldMap - Old map.
- newMap - New map.

Inherited from [IGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#event-mapchange). ||
|| [optionschange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange)| Change to the object options.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange). ||
|| [pixelgeometrychange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#event-pixelgeometrychange)| The pixel geometry changed. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- pixelGeometry - New [IPixelGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPixelGeometry.md) pixel geometry.

Inherited from [IGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#event-pixelgeometrychange). ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [contains](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#contains)([position](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#contains-param-position)) | Boolean
| Checks whether the passed point is located inside the polygon.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#contains). ||
|| [freeze](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#freeze)() | [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md)
| Switches the object to "frozen" mode.

Inherited from [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#freeze). ||
|| [get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#get)([index](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#get-param-index)) | Number[][]
| Returns coordinates of the contour with the specified index.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#get). ||
|| [getBounds](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#getBounds)() | Number[][]\|null
| Returns coordinates of the two opposite corners of the area that surrounds the geometry. The first item in the array is the southwest corner of the area; the second item is the northeast corner.

Inherited from [IGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#getBounds). ||
|| [getChildGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getChildGeometry)([index](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getChildGeometry-param-index)) | [ILinearRingGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILinearRingGeometryAccess.md)
| Creates and returns an [ILinearRingGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILinearRingGeometryAccess.md) object for the specified contour.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getChildGeometry). ||
|| [getClosest](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getClosest)([anchorPosition](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getClosest-param-anchorPosition)) | Object
| Searches for the point nearest to "anchorPosition" on the polygon contour.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getClosest). ||
|| [getCoordinates](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getCoordinates)() | Number[][][]
| Returns an array of geometry coordinates.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getCoordinates). ||
|| [getFillRule](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getFillRule)() | String
| Returns ID of the fill rule.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getFillRule). ||
|| [getLength](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getLength)() | Integer
| Returns the number of contours in the geometry.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#getLength). ||
|| [getMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#getMap)() | [Map](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md)\|null
| Returns the current map.

Inherited from [IGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#getMap). ||
|| [getPixelGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#getPixelGeometry)([[options](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#getPixelGeometry-param-options)]) | [IPixelGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPixelGeometry.md)
| Returns the pixel geometry corresponding to the given geometry, its options, and the map state.

Inherited from [IGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#getPixelGeometry). ||
|| [getType](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometry.md#getType)() | String
| Returns the "Polygon" string.

Inherited from [IPolygonGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometry.md#getType). ||
|| [insert](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#insert)([index](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#insert-param-index), [path](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#insert-param-path)) | [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md)
| Adds a new contour with the specified index.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#insert). ||
|| [isFrozen](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#isFrozen)() | Boolean
| Returns true if the object is in "frozen" mode, otherwise false.

Inherited from [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#isFrozen). ||
|| [remove](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#remove)([index](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#remove-param-index)) | [ILinearRingGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILinearRingGeometryAccess.md)
| Removes the contour with the specified index.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#remove). ||
|| [set](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#set)([index](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#set-param-index), [path](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#set-param-path)) | [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md)
| Sets coordinates of the contour with the specified index.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#set). ||
|| [setCoordinates](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#setCoordinates)([coordinates](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#setCoordinates-param-coordinates)) | [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md)
| Sets an array of geometry coordinates.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#setCoordinates). ||
|| [setFillRule](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#setFillRule)([fillRule](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#setFillRule-param-fillRule)) | [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md)
| Sets the polygon's fill rule.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#setFillRule). ||
|| [setMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#setMap)([map](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#setMap-param-map)) | | Sets the map.

Inherited from [IGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md#setMap). ||
|| [splice](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#splice)([index](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#splice-param-index), [number](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#splice-param-number)) | [ILinearRingGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ILinearRingGeometryAccess.md)[]
| Deletes a defined number of contours, starting from the specified index. New contours can be added in place of the deleted ones. Coordinates of the new contours can be passed as additional arguments after the "number" parameter.

Inherited from [IPolygonGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometryAccess.md#splice). ||
|| [unfreeze](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#unfreeze)() | [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md)
| Switches the object to active mode.

Inherited from [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#unfreeze). ||
|#

