M
M
mills2018-11-30 15:44:52
JavaScript
mills, 2018-11-30 15:44:52

Clustering Yandex maps 2.1, what's wrong?

At the moment the clusters show a lot of labels.
It should be like this:
5c012f5019559079151259.jpeg
At the moment, the strip is like this (the Map is displayed on Bitrix):

<script type="text/javascript">
   ymaps.ready(init);
    var myMap, myPlacemark;
    function init(){
        myMap = new ymaps.Map("map", {
<?php
if (isset($maxCOORD1) and (abs($maxCOORD1) != 0))  { ?>
            center: [<?= $maxCOORD1 + ($maxCOORD1 - $minCOORD1) / 2; ?>, <?=  $minCOORD2 + ($minCOORD2 - $minCOORD2) / 2; ?>],
            zoom: 12,
<?php } else { ?>
            center: [35, 25],
            zoom: 2,
<?php } ?>
      controls: ['zoomControl'],
        });
    var items = <?= json_encode($items); ?>;
    for (i in items) {
  var item = items[i];
  if (item.coord != false) {
      var layout = ymaps.templateLayoutFactory.createClass('<div class="placemark_layout_container"><div title="' + item.hint + '" class="circle_layout hint' + item.id + '"></div>');
      myPlacemark = new ymaps.Placemark(
    item.coord, {
        hintContent: item.hint, 
        balloonContent: item.content
    }, {
        iconLayout: layout,
        iconShape: {
      type: 'Circle', 
      coordinates: [0,0], 
      radius: 22
        }
    });
      myMap.geoObjects.add(myPlacemark);
  } 
    }
    }
</script>

I made this rule code, made changes to show the numbering of clusters in one area, but the map stopped working for me, maybe there is someone fumbling in this?
I would be very grateful for your help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2018-12-03
@SilenceOfWinter

clustering is not implemented for you, and since points coincide in coordinates, then problems arise.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question