This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

All the addresses for a certain country via a SQL query

1

My goal is get all the addresses for some different countries. So I downloaded an *.osm file from here http://download.geofabrik.de/ for a certain territory which contained a few countries and extracted the data from that file using osm2psql to a db. There were no errors, all went well.

The sql query I have to use is something like:

select * from planet_osm_point where addr:housenumber is not null or addr:street is not null.

However, adding and addr:country = 'SOMETHING' won't help because I've tried doing that and got around 100 rows which was, obviously, wrong. I know the polygons is a way to go, isn't it?

So how do I do that?

asked 20 Aug '14, 18:58

memeran's gravatar image

memeran
26113
accept rate: 0%

edited 21 Aug '14, 18:51

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554

Source code available on GitHub .