---
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.Rectangle.md
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/geometry.Rectangle.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/dev/jsapi-v2-1/doc/en/llms.txt

# geometry.Rectangle

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

The "Rectangle" geometry.

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

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

## Constructor {#constructor-summary}

```javascript
geometry.Rectangle([coordinates[, options]])
```

**Parameters:**

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

An array containing coordinates of two opposite corners of the rectangle. ||
|| [`options`](#param-options) | — | Type: Object

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

String ID defining the algorithm for recalculating geometry coordinates as pixel coordinates. For the "Rectangle" geometry, can accept one of three values: 
- shortestPath - Algorithm that considers projection cycling on the axes and generates pixel coordinates so that 	the distance between opposite corners is minimal.
- straightPath - Algorithm that does not consider projection cycling.
- boundsPath - Algorithm that interprets the coordinates of rectangle corners as coordinates corresponding to the lower and upper 	corners of a bounding area. When calculating diagonals for projections with cycled axes, the counter-clockwise 	direction is always used. ||
|| [`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. ||
|#


**Example:**

```javascript
// Creating an instance of the point geometry (specifying coordinates).
var rectangleGeometry = new ymaps.geometry.Rectangle([[30, 50], [31, 51]]);
// Instantiating the geo object and passing our geometry to the constructor.
var rectangleGeoObject = new ymaps.GeoObject({ geometry: rectangleGeometry });

// Changing the coordinates via the geo object's "geometry" property.
rectangleGeoObject.geometry.setCoordinates([[10, 20], [51, 71]]);
// Or directly.
rectangleGeometry.setCoordinates([[10, 20], [51, 71]]);
// You can also access rectangleGeometry via rectangleGeoObject.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/IRectangleGeometryAccess.md#event-change)| Change to corner 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 of the corners.
- newCoordinates - New coordinates of the corners.

Inherited from [IRectangleGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.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/IRectangleGeometryAccess.md#contains)([position](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md#contains-param-position)) | Boolean
| Checks whether the passed point is located inside the rectangle.

Inherited from [IRectangleGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.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). ||
|| [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). ||
|| [getClosest](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md#getClosest)([anchorPosition](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md#getClosest-param-anchorPosition)) | Object
| Searches for the point nearest to "anchorPosition" on the rectangle contour.

Inherited from [IRectangleGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md#getClosest). ||
|| [getCoordinates](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md#getCoordinates)() | Number[][]
| Returns coordinates of two opposite corners of the rectangle.

Inherited from [IRectangleGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md#getCoordinates). ||
|| [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/IRectangleGeometry.md#getType)() | String
| Returns the "Rectangle" string.

Inherited from [IRectangleGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometry.md#getType). ||
|| [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). ||
|| [setCoordinates](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md#setCoordinates)([coordinates](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md#setCoordinates-param-coordinates)) | [IRectangleGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md)
| Sets the coordinates of two opposite corners of the rectangle.

Inherited from [IRectangleGeometryAccess](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IRectangleGeometryAccess.md#setCoordinates). ||
|| [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). ||
|| [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). ||
|#

