V
V
Valery2012-10-03 13:35:03
Yandex maps
Valery, 2012-10-03 13:35:03

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

1 answer(s)
N
Nikolai Vasilchuk, 2012-10-03
@Akuma

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...
});

Only the first result is selected.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question