R
R
Roman Govorov2021-08-03 14:45:17
JavaScript
Roman Govorov, 2021-08-03 14:45:17

How to scale the map depending on the selected region?

I display on the map points of issue throughout Russia. Made a filter by region.
How to make it so that when you click on a region, for example, St. Petersburg, the map focuses on the Leningrad region?

Here is the code:

myMap = new ymaps.Map('yandexMap', {
        center: [55.76, 37.64],
        zoom: 10
    });
    let objectManager = new ymaps.ObjectManager({
        clusterize: true,
        gridSize: 32,
        clusterDisableClickZoom: true,
        controls: [],
        zoomMargin: [20]
    });

    objectManager.objects.options.set('preset', 'islands#greenDotIcon');
    objectManager.clusters.options.set('preset', 'islands#greenClusterIcons');

    myMap.geoObjects.add(objectManager);
    objectManager.add(ObjectYandexJSON);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-08-03
@freeExec

Use Yandex.Map.Regions, get bounds for the desired region and display it on the map.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question