Answer the question
In order to leave comments, you need to log in
How to optimize the output of placemarks on Yandex map?
To display placemarks on the map, I wrote the following code with a loop:
<?php
$js = "
Establishments = new ymaps.GeoObjectCollection();
";
foreach($marksArray as $mark) {
$js .= "
Establishments.add(new ymaps.Placemark([".$mark->lat.", ".$mark->lng."], {
EstablishmentId: ".$mark->id.",
EstablishmentName: '".$mark->name."'
}, {
iconLayout: 'default#image',
iconImageHref: '".$mark->image."',
iconImageSize: [32, 32],
iconImageOffset: [-20, -25]
}));
";
}
$js .= "
myMap.geoObjects.add(Establishments);
";
$this->registerJs($js);
Answer the question
In order to leave comments, you need to log in
https://habrahabr.ru/company/yandex/blog/243665/
There is a clusterer
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question