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 |
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). answered 23 Sep '15, 10:32 Richard ♦ 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 ♦
|
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. answered 23 Sep '15, 10:50 Frederik Ramm ♦ 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
|
Hi MMM333, did u find, in the end, a working solution? I have the same problem.... answered 01 Feb '17, 10:29 gersis |