0

Could you please advise me what is the best way of parsing address from string? I have available a table of addresses exported in the form of OSM Points (city, street, house number, country code, post code, geometry column, ...), and text parameter entered by user, for example:

'Prague Letna 15'

This string I need to parse (city, street name, street number, ...) and based on these data I want select from the Points table the greatest similarity point. I will be grateful for any advice.

I treid this:

select * 
from parse_address('Prague Letna 15')

but result is not good.

enter image description here

Denis Stephanov
  • 4,563
  • 24
  • 78
  • 174
  • 1
    That isnt an easy task, because a street can have same name as a state. You need investigate reverse geocode. The best way is you provide separated fields in the UI for country, state, city, street. – Juan Carlos Oropeza Jan 23 '17 at 13:41
  • I had idea with full text search, merge columns to one string and use some fulltext function, what do you think? – Denis Stephanov Jan 23 '17 at 13:52
  • 1
    Again not easy, I have done that for several years now. I create a function `GeoSearch` just for that and took me more than one year to perfection. Basicly I split the string by `` and try to find match on every table city, sector, street. But that cant be an automatic process. At best you give user suggestion. So depend on where you data came from. If is for user input you need use multiple combobox fields instead one text fields. If you are getting that data from another system, you can do some processing but final result need process by hand. – Juan Carlos Oropeza Jan 23 '17 at 14:06
  • Where does this string come from exactly? OSM doesn't store addresses in this format so it must have a different source. Translating this back into a computer-readable address isn't easy as already explained by Juan. You could try to feed it into a geocoder (Nominatim, Photon, Google Maps). They perform more advanced matchings. – scai Jan 23 '17 at 15:14
  • @scai I need some solution which will be work on my windows server, and Nominatim, Photon and so on works only on linux :/ And data are from osm ... I use osm2pgsql tool and add column for street, country and post code in my final table Points. String come from client over geoserver service, or I can build own service in web api if you think will be better. – Denis Stephanov Jan 23 '17 at 17:26

0 Answers0