W
W
WebforSelf2021-12-27 20:24:14
JavaScript
WebforSelf, 2021-12-27 20:24:14

How is the filling of the address in the Yandex map input implemented?

Good afternoon! I've been struggling with a banal task for 2 days now.
Here is an example of a site - a site

61c9f5a8a2ed0826115575.png

It turns out that the choice of the address goes only for one city? How did they implement it?
Is the search carried out in the green zone?
I tried to limit the zone in this way, but some kind of strange algorithm, other cities still slip through.

suggestView = new ymaps.SuggestView('suggest', {
                            boundedBy: [
                                [
                                    59.633711,
                                    29.425117
                                ],
                                [
                                    60.244813,
                                    30.759528
                                ] // cпб
                            ]
                        }),

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Danny Arty, 2021-12-27
@WebforSelf

Read here .
You need the boundedBy
upd parameter.
Add your provider, in which you will add the desired city at the beginning of the search query Like this (there is a limit for Moscow):

F
freeExec, 2021-12-27
@freeExec

Firstly, you can always look at "how they implemented it", this is the js code available to everyone. I'm already silent, for the lazy, look at the outgoing requests.
Secondly, who is stopping you from filtering the received data from "other cities are skipping".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question