O
O
ortsuev332018-09-27 12:20:05
Yandex maps
ortsuev33, 2018-09-27 12:20:05

How to get the name of the city of the yandex api region?

How to get the name of the city of the yandex api region? from the geocoder

ymaps.ready(init);
    function init(){ 
      	var cord='Грозный,Чеченская республика';
      
        

var myGeocoder = ymaps.geocode(cord);
myGeocoder.then(
    function (res) {
        lat = res.geoObjects.get(0).geometry._coordinates[0];
    lon = res.geoObjects.get(0).geometry._coordinates[1];


    // Создание карты.    
        var myMap = new ymaps.Map("map", {
            // Координаты центра карты.
            // Порядок по умолчнию: «широта, долгота».
            // Чтобы не определять координаты центра карты вручную,
            // воспользуйтесь инструментом Определение координат.
            center: [lat, lon],
            // Уровень масштабирования. Допустимые значения:
            // от 0 (весь мир) до 19.
            zoom: 14,
            controls:['zoomControl']
        });

// Создаем метку.
var placemark = new ymaps.Placemark([lat, lon], {
    balloonContent: 'ыыыы',
    iconContent: "Азербайджан11111111"
}, {
    preset: "islands#yellowStretchyIcon"
    // Отключаем кнопку закрытия балуна.
   
});
myMap.geoObjects.add(placemark);

    

    },
    function (err) {
        alert('Ошибка');
    }
);








    

 

        
    }

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