Answer the question
In order to leave comments, you need to log in
How to search in Yandex.Maps?
Good afternoon,
I'm doing a search on the map through the Ya.Kart API.
For search it is used: api.yandex.ru/maps/doc/jsapi/2.x/ref/reference/geocode.xml
But the fact is that it searches worse than the search string on maps.yandex.ru/
For example, it does not find incomplete street names, even if only one character is missing.
Let's say, to find Krasnaya street, you need to enter its full name, although it is displayed on maps.yandex.ru, even when you enter "Kra" in the search box.
If someone came across, what am I doing wrong? And how to force geocode to search for "scraps" of words?
* Search area limited to the desired city
Answer the question
In order to leave comments, you need to log in
Name the city. This code works for me:
var searchQuery = 'Барнул, Красн 15';
ymaps.geocode(searchQuery, {results: 1}, {results: 100}).then(function (res) {
var geoObject = res.geoObjects.get(0);
if (!geoObject) {
alert('Not found');
return;
}
// Your code...
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question