R
R
Roman Khodakovsky2015-08-17 16:21:55
JavaScript
Roman Khodakovsky, 2015-08-17 16:21:55

How to limit the display area on the map using the Yandex.Map API?

The essence of the task: It is necessary to display a map of the city on the site and limit movement on it to the area of ​​this city. I found a special parameter restrictMapArea
in the API description , but for some reason it is ignored when the map is initialized:

function inc() {
            var map = new ymaps.Map("map", {
                center: [56.3177, 38.1368],
                restrictMapArea:,
                zoom: 15
            });
        }

Actually, what am I doing wrong? Whether there are not "crutch" alternatives?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
forgotten, 2015-08-17
@h_roman

You are trying to pass map options as the second parameter instead of the third.
https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/ref...

Y
YarosWD, 2021-12-22
@YarosWD

Service for determining coordinates https://nominatim.openstreetmap.org/ui/search.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question