S
S
sinneren2021-02-16 18:51:13
JavaScript
sinneren, 2021-02-16 18:51:13

How to correctly search for the nearest point by coordinates, among objects in the objectManager?

There is an objectManager with objects:
const objects = objectManager.objects.getAll();
And the method of geosearch api for Yandex maps geoQuery + getClosestTo ( https://yandex.ru/dev/maps/jsbox/2.1/placemarks_in... )

ymaps.geoQuery(objects).getClosestTo([59.9251823, 30.3361324]);

This approach will throw an error
t.getType is not a function

How to correctly search for the nearest point by coordinates, among objects in the objectManager?

example:
https://jsfiddle.net/7mv5quza/7/
https://jsfiddle.net/m0cfLa4e/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-02-17
@sinneren

ymaps.geoQuery(objectManager.objects).getClosestTo([59.9251823, 30.3361324]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question