M
M
maragon2017-07-20 17:50:53
CMS
maragon, 2017-07-20 17:50:53

How to implement city autocompletion correctly?

The situation is this:
1. I have a real estate website.
2. There are many auto-completion services for cities from kladr (I'm talking about those where there is api)
3. How to store the address selected by the user? (it is clear that there is a database and store it there), then - how to search for saved addresses, cities, streets?
---
Now I have 2 tables, cities (cities) and streets (streets) and I cling the streets to the selected city, the difficulty is that you need to drive in the cities and streets yourself, how uncomfortable and illogical it is, the 21st century is in the yard.
Seek advice from the labor community! Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniel Besedny, 2017-07-20
@danbes1

Not really fumbling, but I think it would be a good option to add a sign 'civil_choose', which will be taken from cities and streets and placed to itself.

M
maragon, 2017-07-20
@maragon

I looked at the Yandex geocoder, it is possible to pull out the name of the region - cities - streets and houses, which is convenient (the region is not yet required for me).
Accordingly, you can create tables cities \ streets (to bind the house \ building to the street).
The question is only in limiting the displayed objects, it is in the Yandex geocoder, but I did not understand how to use these coordinates.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question