0

I need a list of all “City,PostCode,Street” of Italy.

I downloaded from http://download.gisgraphy.com/openstreetmap/pbf/ the IT compressed file, and I followed different steps like below:

Test 1) ./osmfilter IT.pdb --keep="addr:country= and addr:city= and addr:postcode and addr:street=" --ignore-dependencies | ./osmconvert --csv="addr:country addr:city adde:postcode addr:street” --csv-separator=","

But It does not extract ALL the addresses.

Test 2) As suggest here https://help.openstreetmap.org/questions/9816/the-best-way-to-extract-street-list I tried with: "osmfilter with --keep="highway=residential =primary =secondary =tertiaty =unclassified", etc., to get all streets, then use osmconvert with --all-to-nodes and --csv="@lon @lat name etc." to get the CSV list.” But it does not works 100% because It does not extract ALL the Italian's address.

Test 3) I downloaded from http://download.gisgraphy.com/openstreetmap/csv/streets/ the IT list of all the streets, but I don’t know how create a relationship with “City”, “PostCode” and related “Street”.

Someone known how resolve the problem ?

Thanks in advance

asked 23 Sep '15, 10:22

MMM333's gravatar image

MMM333
31112
accept rate: 0%


3 Answers:
5

To build a relationship between city and postcode and streets, you will need city polygons (should be available from OSM) and postcode polygons (unlikely that OSM has these for Italy though), and load them into a PostGIS database together with the street data. Then you can run spatial queries that find the enclosing polygon for each street. A good way to load OSM data into a PostGIS database is the "osm2pgsql" tool.

permanent link

answered 23 Sep '15, 10:50

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
73.3k866641137
accept rate: 24%

Do you know the sql queries that can solve it ? Or do you have some link that could help me ? thanks

(30 Sep '15, 13:38) MMM333

Here the query that resolve part of the problem (just City and Street):

SELECT polygon.name,line.name FROM planet_osm_line AS line CROSS JOIN planet_osm_polygon AS polygon WHERE polygon.admin_level = '8' AND ST_Contains(polygon.way, line.way) AND line.highway in ('primary', 'secondary', 'tertiary', 'road', 'residential','motorway', 'trunk', 'unclassified') GROUP BY polygon.name,line.name

Do you think it could be optimized ?

Unfortunately there is no postal code polygon for Italy, so I can't create the wished relationship.

(02 Oct '15, 09:02) MMM333
3

It probably doesn't extract ALL the addresses because OpenStreetMap doesn't have ALL the addresses in Italy. It only has the ones that people have mapped.

If there is data that you know is in OpenStreetMap, but you can't extract it, then please cite an example (using a link to that place on osm.org).

permanent link

answered 23 Sep '15, 10:32

Richard's gravatar image

Richard ♦
28.5k40253383
accept rate: 19%

Thanks Richard, When I say "does not extract ALL the addresses" I mean “from" the file. Here the example: $ grep Marchisio IT.xml <tag k="name" v="Via Tancredi Marchisio"/> #note: "via" mean "street" <tag k="name" v="Via Pietro Marchisio"/> etc…

$./osmfilter IT.xml --keep="addr:country= and addr:city= and addr:postcode= and addr:street=" --ignore-dependencies | ./osmconvert - --csv="addr:country addr:city addr:postcode addr:street" --csv-separator="," | sort | uniq > all_italian.csv

$ wc -l all_italian.csv 16810 all_italian.csv #all italian address are ~ 200k

$grep “Marchisio” all_italian.csv # -> No result

(23 Sep '15, 13:26) MMM333
2

That's not an error, just missing address data in OSM. Although Via Tancredi Marchisio exists as a street name there is not even a single address for it in OSM, see http://www.openstreetmap.org/#map=19/44.38597/9.01461

(23 Sep '15, 13:57) scai ♦
0

Hi MMM333, did u find, in the end, a working solution? I have the same problem....

permanent link

answered 01 Feb '17, 10:29

gersis's gravatar image

gersis
1
accept rate: 0%

edited 01 Feb '17, 10:29

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×117
×91
×71
×46
×31

question asked: 23 Sep '15, 10:22

question was seen: 6,591 times

last updated: 01 Feb '17, 10:49

powered by OSQA