S
S
sinneren2020-09-25 17:16:39
JavaScript
sinneren, 2020-09-25 17:16:39

How to get visible objects on map after boundschange using objectManager?

I looked at the examples, they all do not fit \ do not work

First of all, I create an objectManager:

instance.objectManager = new ymaps.ObjectManager({
   clusterize: true,
});

Next, I create a map.
Then, from my data, I create a feature json FeatureCollection.
After creation, I delete all data from the objectManager (because I have object filtering not through setFilter, but by filtering my data).

instance.objectManager.removeAll();

And then, I add json features: `instance.objectManager.add(instance.map_features);`

Then I add the manager object to the geo objects:
instance.map.geoObjects.add(instance.objectManager);


Next, I listen to the map shift event and try to get all the objects for which I want to use the searchInside method to find those that are currently displayed on the map:
instance.map.events.add('boundschange', function () {
   console.log(ymaps.geoQuery(instance.objectManager.objects.getAll()).searchInside(instance.map));
});


In this case, `instance.objectManager.objects.getAll()` I get all the objects, and I was able to get them only in this way, but the search error: `map.action.Continuous: ticking while inactive. browser:Chrome behavior:drag`

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question