W
W
wanderbit2015-11-12 09:05:29
Yandex
wanderbit, 2015-11-12 09:05:29

Properties not applied to GeoObjectCollection?

Properties not applied to GeoObjectCollection in particular icon change

ymaps.ready(function () {
var myMap = new ymaps.Map('map', {
center: [55.751574, 37.573856],
zoom: 9,
controls: []
}, {
searchControlProvider: 'yandex#search'
});
var searchControl = new ymaps.control.SearchControl({
options: {
position: { left: 250, top: 50 },
// float: 'right',
floatIndex: 100,
noPlacemark: true,
left:50
}
});
var myCollection = new ymaps.GeoObjectCollection({
options:{
iconLayout: 'default#image',
// Custom label icon image.
iconImageHref: 'icon.png',
// Label size.
iconImageSize: [30, 42],
// Offset of the upper left corner of the icon relative to
// its "legs" (anchor points).
iconImageOffset: [-3, -42]
}
});
// Adding labels to the collection.
myCollection.add(new ymaps.Placemark([55.743517277269156,37.505507499999915]));
myCollection.add(new ymaps.Placemark([55.64192027765163,37.52345549999994]));
myCollection.add(new ymaps.Placemark([55.68452827749535,37.62410349999998]));
myCollection.add(new ymaps.Placemark([55.42569577845532,37.545419499999944]));
myCollection.add(new ymaps.Placemark([55.654568777603394,37.540532499999934]));
myMap.controls.add(searchControl);
myMap.geoObjects.add(myCollection);
myMap.setBounds(myCollection.getBounds());
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wanderbit, 2015-11-12
@wanderbit

var myCollection = new ymaps.GeoObjectCollection();
myCollection.options.set({
iconImageHref: 'yandex.st/lego/_/X31pO5JJJKEifJ7sfvuf3mGeD_8.png',
iconImageSize: [95, 37], // размеры картинки
iconImageOffset: [-11, -30] // смещение картинки
});

так тоже не применяется

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question