Answer the question
In order to leave comments, you need to log in
How to change the placemark icon in the markers already placed on the map?
The point is this. I have an ajax request every 10 seconds, which pulls out the coordinate of the current location of the object from the database. All the coordinates that I pull out I store in myCollection of type GeoObjectCollection . Here is part of the code:
myPlacemark = new ymaps.Placemark([data.lat, data.lon], {
content: counter,
hintContent: 'Собственный значок метки'
}, {
iconLayout: 'default#image', // тип макета
//iconImageHref: 'http://api.yandex.ru/maps/doc/jsapi/2.x/examples/images/myIcon.gif',
//iconImageSize: [30, 42], // размеры метки
//iconImageOffset: [-3, -42]
});
myCollection.add(myPlacemark);
myMap.geoObjects.add(myCollection);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question