D
D
Danandavi2019-11-19 15:36:38
JavaScript
Danandavi, 2019-11-19 15:36:38

How to prevent clusters from displaying hidden points on the map?

Good afternoon. I have a map with dots. I go through the loop through these points and, by condition, hide certain points, but the cluster displays all points (including hidden ones). How to prevent clusters from displaying hidden points on the map?

for (let i = 0; i < text_markers.length; i++ ) {

      let html = "";

      myPlacemark[i] = new ymaps.Placemark([text_markers[i].left_c, text_markers[i].right_c], {
        balloonContent: '<div class="d-flex baloon-wrap"><img src="'+text_markers[i].img+'" alt=""><div class="baloon-wrap__right">'+html+'</div></div>'
      },{
        balloonMaxWidth: 700
      });
      if(text_markers[i].type == type_map){
        myPlacemark[i].options.set('visible', true);
      } else{
        myPlacemark[i].options.set('visible', false);
      }			
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Danandavi, 2019-12-09
@Danandavi

I solved the problem by removing unnecessary points and drawing the necessary ones again. Perhaps not the most correct solution, but the cluster does not "stupid" with it.

F
freeExec, 2019-11-19
@freeExec

You need to filter through the object manager
https://tech.yandex.ru/maps/jsbox/2.1/object_manag...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question