Answer the question
In order to leave comments, you need to log in
Yandex Maps get Placemark coordinates after moving?
There are many Placemarks, each with its own text, added via add(
myMap.geoObjects
.add(myPolyline)
.add(new ymaps.Placemark([53.8, 36.3], {
iconContent: '1',
iconColor: '#3caa3c',
balloonContent: '1| 06:51'
}, {
draggable: true
})).add(new ymaps.Placemark([53.9, 36.2], {
iconContent: '2',
iconColor: '#4d7198',
balloonContent: '2| 07:26'
}, {
draggable: true
}));
myMap.geoObjects.events.add([
'dragend'
], function(e) {
//надо получить lat и lon точки куда переместили placemark
});
Answer the question
In order to leave comments, you need to log in
Solution found:
myMap.geoObjects.events.add([
'dragend'
], function (e) {
var placemarkPosition = myMap.options.get('projection').fromGlobalPixels(
myMap.converter.pageToGlobal(e.get('position')),
myMap.getZoom()
);
console.log(placemarkPosition); // - координаты.
e.get('target').properties.get('iconContent'); // - iconContent
});
iw.luna.kg/test_map_functional
You will see the script in the code, you can read it right away.... Added comments.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question