How to remove the Yandex.Kart buttons with API?



  • I'm building a map with a mark, it's all right, it's not a problem. But here's the problem, there's a bunch of unnecessary information on the map, that's standard Yandex buttons. Printskin. введите сюда описание изображения

    How I make a map.

    // Дождёмся загрузки API и готовности DOM.
    ymaps.ready(init);
    

    function init () {
    // Создание экземпляра карты и его привязка к контейнеру с
    // заданным id ("map").

    var myMap;
    ymaps.geocode('<?echo $event['address']?>').then(function (res) {
        myMap = new ymaps.Map('map', {
            center: res.geoObjects.get(0).geometry.getCoordinates(),
            zoom : 16
        }),
        // Создаем геообъект с типом геометрии "Точка".
        myGeoObject = new ymaps.GeoObject({
    
        });
    
        var myGeocoder = ymaps.geocode("<?echo $event['address']?>");
        myGeocoder.then(
        function (res) {
            console.log(res.geoObjects.get(0).geometry.getCoordinates());
            //myMap.geoObjects.add(res.geoObjects);
            myMap.geoObjects.add(new ymaps.Placemark(
            res.geoObjects.get(0).geometry.getCoordinates(), {
            hintContent: '<?echo $event['title']?>',
            balloonContent: '<?echo $event['title']?>'
        }, {
            iconLayout: 'default#image',
            // Своё изображение иконки метки.
            //iconImageHref: 'default#shopIcon',
            // Размеры метки.
            //iconImageSize: [15, 26],
            // Смещение левого верхнего угла иконки относительно
            // её "ножки" (точки привязки).
    
        }))
        }
        );
    });
    

    }

    Can you tell me how to remove all the extra buttons?



  • To change the set of counterfeit cards, add the properties control Second Parameter. For example, to clean up everything, point out an empty mass when the map is established.

    ...
        myMap = new ymaps.Map('map', {
            center: res.geoObjects.get(0).geometry.getCoordinates(),
            zoom : 16,
            controls: []
        }),
    ...
    

    You can watch. https://tech.yandex.ru/maps/doc/jsapi/2.1/ref/reference/control.Manager-docpage/#add-param-control Contraceptors and their kits, which are silent or may add their control.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2