R
R
rinatoptimus2016-10-04 11:57:32
JavaScript
rinatoptimus, 2016-10-04 11:57:32

How to change the position of the mark on the Yandex map?

I brought out a map with a label on the site, but the label is located immediately in the center. The fact is that you need the label to be a little to the left so that the content fits on the right. Can't find how to change this setting?

ymaps.ready(init);
 
function init(){     
 
    var myMap;
 
    myMap = new ymaps.Map("map", {
        //center: [55.7652, 37.63836],  // 
        center: [59.8816, 30.31581],

        //zoom: 17,
        zoom: 16,

        controls: []
    });
 
    myMap.behaviors.disable('scrollZoom');
 
    myMap.controls.add("zoomControl", {
        position: {top: 15, left: 15}
    });
 
    //var myPlacemark = new ymaps.Placemark([55.7649, 37.63836] , {},
    //var myPlacemark = new ymaps.Placemark([59.8816, 30.31581] , {},
    var myPlacemark = new ymaps.Placemark([59.8816, 30.31581] , {},

        { iconLayout: 'default#image',
          iconImageHref: 'map-balloon.png',
          //iconImageSize: [290, 152],
          iconImageSize: [300, 157],

          //iconImageOffset: [-20, -47] });
          iconImageOffset: [-110, -67] });      
 
    myMap.geoObjects.add(myPlacemark);
 
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2016-10-04
@rinatoptimus

the necessary coordinates of the label can be found using this service:
look for the address and then, if necessary, move the label a
little dimik.github.io/ymaps/examples/location-tool
A working example is here: https://jsfiddle.net/nugget_sti/afx40bgx /

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question