A
A
Artem2017-11-03 13:35:35
PHP
Artem, 2017-11-03 13:35:35

How to implement user search by locality?

There is a task to implement search of users. There are two groups of users - the customer and the executor. When registering, the contractor indicates in which city, district or even throughout the country the service is provided. And there is a customer who, when placing an order, indicates the address where the work needs to be done. How to search for all artists? If the customer or contractor indicated some distance, then everything could simply be found by coordinates and by distance using google places. But the problem is that it is necessary to take into account the entire city, region or the whole country. It is also necessary not to forget about performance.
Thanks in advance for your attention to my question.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Korobkov, 2017-11-03
@BorisKorobkov

Judging by the task, you do not need distances. You only need to know the nesting of objects: which district is included in which city, the city - in the region, the region - in the country. If the artist's geo-object matches or contains the customer's geo-object, merge them.

K
KazeZlat, 2017-11-03
@KazeZlat

If your location is specified not by text, but by a choice from the directory (Country, Region, Settlement), then it will be very easy to get matching addresses.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question