I've got an osm
file containing the city I live in. Now I've got a tool to render and display it in the browser (mapnik
+postgis
+tilecache
+openlayers
+geoext
) and the task is to make an address search.
I know that I can use nominatim (and actualy I use it for now), but I'd like to create my own service.
So the question is: how can I (if I can) get all adresses and their coordinates from the osm
file or it's exported to postgis
version?
Best Answer
Have a look to see if there are any columns in your database named "
addr
" or similar. If there are then you may be able to query the database directly and isolate these rows.If not, you probably need to create a database schema with address tags included from scratch. Broadly how I might go about doing it is as follows:
addr:*
prefix. Probably using the --tag-filter. It might be easier to filter out only points, but some polygons may have the tag as well.Steps 1 and 2 could be replaced by creating your own osm2pgsql schema, which might be easier.
If this seems like a lot of work that's because it is. AFAIK there are relatively few osm tools to support getting addresses like this at the moment, but happy to be corrected. I would check before you start that it's going to be worth your while - i.e. people have been busy in your area tagging addresses on the map and address tags are not very sparse.