getZoomRange

Static function.

Checks the available range of zoom levels at the specified point for the specified map type.

Returns a Promise, which will be resolved and will get an array of two numbers as a parameter - the maximum and minimum zoom at the given point.

{ vow.Promise } getZoomRange(mapType, coords, customizable)

Parameters:

Parameter

Default value

Description

mapType*

Type: String|MapType

Map type. Key string from mapType.storage, or an instance of the MapType class.

coords*

Type: Number[]

Coordinates of the point to find out the available range of zoom levels for.

customizable*

Type: ICustomizable=null

Object that contains the options manager. The object options will be considered when getting the result.

* Mandatory parameter/option.

Examples:

1.

// Let's say we want to initialize the map at the maximum zoom.
var myMap;
ymaps.getZoomRange('yandex#map', [55.750516, 37.615924]).then(function (result) {
     myMap = new ymaps.Map('mapContainer', {
         center: [55.750516, 37.615924],
         zoom: result[1]
     });
});

2.

// Initialize the map using the geocoder, centered at Lev Tolstoy street, number 16
// at the maximum zoom possible.
var myMap;
ymaps.geocode("Moscow, Lev Tolstoy, 16").then(function (geoData) {
    var coords = geoData.geoObjects.get(0).geometry.getCoordinates();
    ymaps.getZoomRange('yandex#map', coords).then(function (zoomRange) {
        myMap = new ymaps.Map('mapContainer', {
           center: coords,
           zoom: zoomRange[1]
        });
    });
});