Answer the question
In order to leave comments, you need to log in
Looking for the nearest object on the map?
I have a collection of my points (elements) on a map. There are 20 of them now. I need to determine the user's location by clicking and search for the nearest point that is on the map.
GeoQueryResult(objectCollection.toArray()).getClosestTo(result.geoObjects.get(0).geometry._coordinates).balloon.open();
objectCollection
- a collection of points on the map - user coordinates (everything works well here)
If you try the example from Yandex , then everything is fine, BUT if I replace the cafe variable from the example with my collection, then nothing works.
Maybe I need to convert my collection to something else? Collection does not work. result.geoObjects.get(0).geometry._coordinates
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question