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

# util.bounds

Static object.

Set of statistical methods for working with rectangular areas, represented as two opposite points in the coordinate system of the projection.

[Methods](#methods-summary)

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [areIntersecting](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#areIntersecting)([bounds1](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#areIntersecting-param-bounds1), [bounds2](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#areIntersecting-param-bounds2)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#areIntersecting-param-projection)]) | Boolean | Determines whether two rectangular areas intersect. ||
|| [containsBounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#containsBounds)([outer](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#containsBounds-param-outer), [inner](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#containsBounds-param-inner)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#containsBounds-param-projection)]) | Boolean | Determines whether a rectangular area completely contains another rectangular area. ||
|| [containsPoint](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#containsPoint)([bounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#containsPoint-param-bounds), [point](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#containsPoint-param-point)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#containsPoint-param-projection)]) | Boolean | Determines whether a rectangular area contains a point. ||
|| [fromBounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromBounds)([sourceBounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromBounds-param-sourceBounds)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromBounds-param-projection)]) | Number[][] | Calculates the rectangular area that everything passed falls inside of. ||
|| [fromGlobalPixelBounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromGlobalPixelBounds)([pixelBounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromGlobalPixelBounds-param-pixelBounds), [zoom](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromGlobalPixelBounds-param-zoom)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromGlobalPixelBounds-param-projection)]) | Number[][] | Converts a rectangular area from pixel coordinates to geo coordinates with the zoom factor taken into account. ||
|| [fromPoints](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromPoints)([points](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromPoints-param-points)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#fromPoints-param-projection)]) | Number[][] | Calculates the minimal rectangular area that contains all the passed points. ||
|| [getCenter](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getCenter)([bounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getCenter-param-bounds)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getCenter-param-projection)]) | Number[] | Calculates the center of a rectangular area in the coordinate system of the projection. ||
|| [getCenterAndZoom](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getCenterAndZoom)([bounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getCenterAndZoom-param-bounds), [containerSize](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getCenterAndZoom-param-containerSize)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getCenterAndZoom-param-projection)[, [params](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getCenterAndZoom-param-params)]]) | Object | Calculates the center and zoom that should be set for the map in order to display the passed area in its entirety. ||
|| [getIntersections](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getIntersections)([bounds1](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getIntersections-param-bounds1), [bounds2](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getIntersections-param-bounds2)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getIntersections-param-projection)]) | Number[][][] | Returns all intersections of two rectangular areas. If data is passed in geo coordinates, there may be more than one intersection. If the areas do not intersect, an empty array is returned. ||
|| [getSize](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getSize)([bounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getSize-param-bounds)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#getSize-param-projection)]) | Number[] | Calculates the dimensions of a rectangular area in the coordinate system of the projection. ||
|| [toGlobalPixelBounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#toGlobalPixelBounds)([geoBounds](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#toGlobalPixelBounds-param-geoBounds), [zoom](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#toGlobalPixelBounds-param-zoom)[, [projection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/util.bounds.md#toGlobalPixelBounds-param-projection)]) | Number[][] | Converts boundaries from geo coordinates to global pixels, accounting for the zoom level.||
|#

## Methods details {#method_detail}

### areIntersecting  {#areIntersecting}

```javascript
{Boolean} areIntersecting(bounds1, bounds2[, projection])
```

Determines whether two rectangular areas intersect.

**Returns** intersection attribute.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`bounds1`](#areIntersecting-param-bounds1)[*](*star) | — | Type: Number[][]

First area. ||
|| [`bounds2`](#areIntersecting-param-bounds2)[*](*star) | — | Type: Number[][]

Second area. ||
|| [`projection`](#areIntersecting-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|#

\* Mandatory parameter/option.

### containsBounds {#containsBounds}

```javascript
{Boolean} containsBounds(outer, inner[, projection])
```

Determines whether a rectangular area completely contains another rectangular area.

**Returns** inclusion attribute.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`outer`](#containsBounds-param-outer)[*](*star) | — | Type: Number[][]

External area ||
|| [`inner`](#containsBounds-param-inner)[*](*star) | — | Type: Number[][]

The area being checked. ||
|| [`projection`](#containsBounds-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|#

\* Mandatory parameter/option.

### containsPoint {#containsPoint}

```javascript
{Boolean} containsPoint(bounds, point[, projection])
```

Determines whether a rectangular area contains a point.

**Returns** inclusion attribute.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`bounds`](#containsPoint-param-bounds)[*](*star) | — | Type: Number[][]

External area ||
|| [`point`](#containsPoint-param-point)[*](*star) | — | Type: Number[]

The point being checked. ||
|| [`projection`](#containsPoint-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|#

\* Mandatory parameter/option.

### fromBounds {#fromBounds}

```javascript
{Number[][]} fromBounds(sourceBounds[, projection])
```

Calculates the rectangular area that everything passed falls inside of.

**Returns** the calculated area.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`sourceBounds`](#fromBounds-param-sourceBounds)[*](*star) | — | Type: Number[][][]

Array of rectangular areas ||
|| [`projection`](#fromBounds-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|#

\* Mandatory parameter/option.

### fromGlobalPixelBounds {#fromGlobalPixelBounds}

```javascript
{Number[][]} fromGlobalPixelBounds(pixelBounds, zoom[, projection])
```

Converts a rectangular area from pixel coordinates to geo coordinates with the zoom factor taken into account.

**Returns** calculated boundaries in geo coordinates.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`pixelBounds`](#fromGlobalPixelBounds-param-pixelBounds)[*](*star) | — | Type: Number[][]

Original boundaries. ||
|| [`zoom`](#fromGlobalPixelBounds-param-zoom)[*](*star) | — | Type: Number

Scale. ||
|| [`projection`](#fromGlobalPixelBounds-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

The projection that will be used for claculating geo coordinates. ||
|#

\* Mandatory parameter/option.

### fromPoints {#fromPoints}

```javascript
{Number[][]} fromPoints(points[, projection])
```

Calculates the minimal rectangular area that contains all the passed points.

**Returns** the calculated area.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`points`](#fromPoints-param-points)[*](*star) | — | Type: Number[][]

Array of points. ||
|| [`projection`](#fromPoints-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|#

\* Mandatory parameter/option.

### getCenter {#getCenter}

```javascript
{Number[]} getCenter(bounds[, projection])
```

Calculates the center of a rectangular area in the coordinate system of the projection.

**Returns** center point in the coordinate system of the input data.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`bounds`](#getCenter-param-bounds)[*](*star) | — | Type: Number[][]

Area. ||
|| [`projection`](#getCenter-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|#

\* Mandatory parameter/option.

### getCenterAndZoom {#getCenterAndZoom}

```javascript
{Object} getCenterAndZoom(bounds, containerSize[, projection[, params]])
```

Calculates the center and zoom that should be set for the map in order to display the passed area in its entirety.

**Returns** object with the center (Number[]) and zoom (Number) fields.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`bounds`](#getCenterAndZoom-param-bounds)[*](*star) | — | Type: Number[][]

An area set in geographical coordinates. The first point contains the minimum values for latitude and longitude, and the second point contains the maximum values. ||
|| [`containerSize`](#getCenterAndZoom-param-containerSize)[*](*star) | — | Type: Number[]

Size of the map container. ||
|| [`projection`](#getCenterAndZoom-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|| [`params`](#getCenterAndZoom-param-params) | — | Type: Boolean\|Object

Parameters or value of the preciseZoom option. ||
|| [`params.inscribe`](#getCenterAndZoom-param-params.inscribe) | true | Type: Boolean

If true, fit the area into the map; if false, fit the map into the area. ||
|| [`params.margin`](#getCenterAndZoom-param-params.margin) | 0 | Type: Number\|Number[]

Offset from the borders of the visible area of the map. If a single number is set, it is applied to each side. If two numbers are set, they are the horizontal and vertical margins, respectively. If an array of four numbers is set, they are the top, right, bottom, and left margins. ||
|| [`params.preciseZoom`](#getCenterAndZoom-param-params.preciseZoom) | false | Type: Boolean

When the value is "false", the zoom level is rounded down. ||
|#

\* Mandatory parameter/option.

### getIntersections {#getIntersections}

```javascript
{Number[][][]} getIntersections(bounds1, bounds2[, projection])
```

**Returns** all intersections of two rectangular areas. If data is passed in geo coordinates, there may be more than one intersection. If the areas do not intersect, an empty array is returned.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`bounds1`](#getIntersections-param-bounds1)[*](*star) | — | Type: Number[][]

First area. ||
|| [`bounds2`](#getIntersections-param-bounds2)[*](*star) | — | Type: Number[][]

Second area. ||
|| [`projection`](#getIntersections-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|#

\* Mandatory parameter/option.

### getSize {#getSize}

```javascript
{Number[]} getSize(bounds[, projection])
```

Calculates the dimensions of a rectangular area in the coordinate system of the projection.

**Returns** size of the area.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`bounds`](#getSize-param-bounds)[*](*star) | — | Type: Number[][]

Area. ||
|| [`projection`](#getSize-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

Projection. ||
|#

\* Mandatory parameter/option.

### toGlobalPixelBounds  {#toGlobalPixelBounds}

```javascript
{Number[][]} toGlobalPixelBounds(geoBounds, zoom[, projection])
```

Converts boundaries from geo coordinates to global pixels, accounting for the zoom level.

**Returns** resulting pixel boundaries.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`geoBounds`](#toGlobalPixelBounds-param-geoBounds)[*](*star) | — | Type: Number[][]

Original boundaries. ||
|| [`zoom`](#toGlobalPixelBounds-param-zoom)[*](*star) | — | Type: Number

Scale. ||
|| [`projection`](#toGlobalPixelBounds-param-projection) | [projection.wgs84Mercator](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/projection.wgs84Mercator.md) | Type: [IProjection](https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IProjection.md)

The projection in the coordinate system that the geo coordinates are set in. ||
|#

\* Mandatory parameter/option.

[*star]: Mandatory parameter/option.