Hi,
I try to create a CSV file with street names, postcodes and city names:
wget https://download.geofabrik.de/europe/hungary-latest.osm.pbf
osmconvert hungary-latest.osm.pbf -o=hun.o5m
osmfilter hun.o5m --keep="addr:postcode=* addr:country= addr:city= addr:street= highway=cycleway highway=path highway=primary highway=residential highway=tertiary" | osmconvert - --csv="name addr:postcode addr:city addr:street" --csv-separator="," > hun_streets.csv
A useful output would be like this (postcode, city, street) that is present in the CSV:
2941,Ács,Posta köz
However, "Posta köz" is listed in an incomplete way:
Posta köz,,,
Instead of showing up like this:
2011,Budakalász,Posta köz
"Posta köz" can be seen here: https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=361968551&class=highway
Using the command below, this entry is not visible in the output:
osmfilter hun.o5m --keep="highway=residential" | osmconvert - --csv="addr:street" --csv-separator="," > hun_residential.csv
grep -i "posta köz" hun_residential.csv
And this returns with only 66 street names which is a very low number.
cat hun_residential.csv | wc -l
Any ideas how to get city,postcode and street names next to each other?
asked
12 Apr, 14:48
jovokep
11●1●3
accept rate:
0%
What happens if you include 'name' in the osmconvert output?
I expect the issue is that you aren't causing highways to be included in that step, but I'm not terribly familiar with the tools.
After adding "name" I see 141820 lines which is promising. The issue is that I don't see the postcode or any other data related to this street.
Output is: "Posta köz,,,"
A useful output would be like this (postcode, city, street) 2941,Ács,Posta köz
For reference, this is how I try to create a CSV with street names, postcodes and city names:
I've edited the whole question for greater clarity.
So nominatim processes the raw data that is included in hungary-latest.osm.pbf to match up streets and cities/postcodes/etc. In the .pbf file, the street is stored as a line, and then separately, a city or postcode is stored as an area(this is over-simplified, but it's close enough). Nominatim goes through and makes the associations.
It will take a long time to query so many streets from the public servers (and such high volume is heavily discouraged). It's possible to run a local copy that is limited to a smaller area.
I'd like to make these associations too, offline. The question is what is an easy way to do it?
If I could count on the fact that all streets belonging to the same city are listed together (and not randomly in the CSV output) then I would be able to fill in the gaps.