V
V
viktorulyushev2021-08-04 21:02:05
Yandex maps
viktorulyushev, 2021-08-04 21:02:05

How to limit the scope of the map to a region?

It turns out to add a region to the map, but how to get the restrictMapArea of ​​this region to crop the map?
I didn't find it on the open street map either.

ymaps.ready(function () {
    var myMap = new ymaps.Map('map', {
        center: [59.938,30.3],
        zoom: 9,
        controls: ['smallMapDefaultSet']
    }, {
        // Зададим ограниченную область прямоугольником, 
        // примерно описывающим Санкт-Петербург.
        restrictMapArea: [
            [59.838,29.511],
            [60.056,30.829]
        ]
    });
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question