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

# map.Converter

Class for converting global pixel coordinates of a point (calculated from the upper-left corner of the world) to local coordinates (calculated from the upper-left corner of the window) and back. Each map already has its own converter, available as map.converter. Don't instantiate new instances of this class unless necessary.

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

[Constructor](#constructor-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
map.Converter(map)
```

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`map`](#param-map)[*](*star) | — | Type: [Map](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md)

Reference to the map. ||
|#

\* Mandatory parameter/option.

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [globalToPage](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.Converter.md#globalToPage)([globalPixelPoint](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.Converter.md#globalToPage-param-globalPixelPoint)) | Number[] | Converts global pixel coordinates of a point to local coordinates. ||
|| [pageToGlobal](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.Converter.md#pageToGlobal)([pagePixelPoint](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/map.Converter.md#pageToGlobal-param-pagePixelPoint)) | Number[] | Converts local pixel coordinates of a point to global coordinates.||
|#

## Methods details {#method_detail}

### globalToPage {#globalToPage}

```javascript
{Number[]} globalToPage(globalPixelPoint)
```

Converts global pixel coordinates of a point to local coordinates.

**Returns** the converted coordinates.

**Parameters:**

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

Pixel coordinates of a point that need to be converted. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
// Converting geographical coordinates to browser window pixels
var projection = map.options.get('projection');
console.log(map.converter.globalToPage(
    projection.toGlobalPixels(
        // geographical coordinates
        [55, 37],
        map.getZoom()
    )
));
```

### pageToGlobal {#pageToGlobal}

```javascript
{Number[]} pageToGlobal(pagePixelPoint)
```

Converts local pixel coordinates of a point to global coordinates.

**Returns** the converted coordinates.

**Parameters:**

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

Pixel coordinates of a point that need to be converted. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
// Converting mouse cursor coordinates to geocoordinates
var projection = map.options.get('projection');
$('#map').bind('click', function (e) {
    console.log(projection.fromGlobalPixels(
        map.converter.pageToGlobal([e.pageX, e.pageY]), map.getZoom()
    ).join(', '));
});
```

[*star]: Mandatory parameter/option.