A
A
Alexey Orlov2020-05-28 17:17:57
JavaScript
Alexey Orlov, 2020-05-28 17:17:57

How to put a label on Yandex.Map correctly?

There is the following label:
3262642adef3b768e7fc390be3200b8f.png

How to place it correctly on Yandex.Map. If you fully load the entire image onto the map, then it constantly shifts when scaling. If I load only the blue label, then everything is ok, but how to make such a plate for it from below?

My blue label code:

ymaps.ready(init);
function init(){
    // Создание карты.
    var myMap = new ymaps.Map("map", {
        center: [55.785205, 37.717187],
        zoom: 17
    });

    var myPlacemark = new ymaps.Placemark(myMap.getCenter(), {}, {
        iconLayout: 'default#image',
        iconImageHref: '../../../../img/svg/contacts/map__icon.svg',
        iconImageSize: [24, 32],
    });
    
    // Размещение геообъекта на карте.
    myMap.geoObjects
        .add(myPlacemark); 
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-05-28
@LeshaGFB

Set an anchor point for a large image iconImageOffsetand nothing will move.
Or use a karst html balloon.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question