Shoaib Ijaz
Shoaib Ijaz

Reputation: 5597

How can extract location from text

I am working on web mapping application and i am facing issue, scenario is that.

User can post address and address can be in any format like

Street, City,State, Country or Country Street State City

I have mentioned just two format but it would be in any format.

My task is extract City Name, Street, Country from address, problem is that multiple city name, street may be exist so how can i do this.

I have all information about locations in database like city,country,street,area code.

Upvotes: 2

Views: 685

Answers (1)

Darkcylde
Darkcylde

Reputation: 869

I don't believe there is an easy way to do what you want here. It seems the user can give the data in such a way that it is basically free form and there is no way to distinguish from the input data what is a street name vs what is a city name ect. Unless you enforce some sort of format nothing is going to work every time.

A different approach may be to take the input remove such things as "St" and "Street" ect and then search the database for each of the given names against city, street and county ect. From the results you will probably be able to determine what is the most likely address and get the user to confirm.

A lot of government websites appear to use the approach I have just given you above when registering for things. (i.e. Voting) It is not perfect however.

Upvotes: 1

Related Questions