I would like to ask you how a given address can be divided into separate administrative divisions of provinces, cities and regions. I have been thinking about it all day without any ideas.

ask for help from seniors: if the long address is xxxx, Nanjing Road, Heping District, Tianjin

how can it be dealt with by means of no manual intervention: Tianjin; Heping District; Nanjing Road; this kind of administrative division?

because the input is uncertain, such as the absence of "province", "city", "district", or the more bizarre place names and streets,

Thank you for your ideas, thank you,


of course.
A typical database is as follows (the structure is correct, and the data is typed at random. There are many such libraries on the Internet)

6 administrative division code division name (province is province name, city is city name, District similar) higher administrative division code
100000 Tianjin 0 Tianjin is a municipality directly under the Central Government
100100 Tianjin 100000
100101 Heping District 100100

  1. first traverse the match in all provinces, and if the match is successful, the matching part is the province, save it, and then delete the original address
  2. the next string matches in the city, and the match is as successful as 1
  3. . Similar to

if the user input is not correct, you should send the user input to the background query and return the place names in the similar database to the foreground for the user to fill in


because the content entered by the user is too uncertain, it is now recommended to enter it to the administrative region by choice, and the last short address is entered by the user.
it is very complicated to find the detailed address from the fuzzy data. For example, if I do not enter the province and city, I only enter the administrative region. How can you do it? Of course, there is still a way, because someone has implemented it, such as Amap.
but the cost is too high, far greater than the cost of letting the user choose input.

clipboard.png
compare biased methods.
Amap's address code can be searched vaguely and the formatted address can be returned.
ide/api/georegeo" rel=" nofollow noreferrer "> http://lbs.amap.com/api/webse.

Menu