Answer the question
In order to leave comments, you need to log in
How to dynamically combine marks on a Yandex map into a cluster?
Hello!
There is an array of coordinates by which marks are added to the map.
Some objects may have the same coordinates.
How can you dynamically combine objects into a cluster?
Currently created like this:
function init() {
var myMap = new ymaps.Map("map", {
center: [45.035471,38.975312],
zoom: 11,
controls: [
'zoomControl',
'rulerControl',
'routeButtonControl',
'trafficControl',
'typeSelector',
'fullscreenControl',
new ymaps.control.SearchControl({
options: {
size: 'large',
provider: 'yandex#search'
}
})
]
});
myCollection = new ymaps.GeoObjectCollection(null);
$.each(objs, function(propName, propVal) {
var coords = propVal.split(',');
myCollection.add(new ymaps.Placemark(coords, {
hintContent: ''+propName+'',
}, {
iconLayout: 'default#image',
iconImageHref: '/assets/img/marker.png',
iconImageSize: [48, 48],
iconImageOffset: [0, 0]
}));
});
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