NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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 '20, 14:48

jovokep's gravatar image

jovokep
11113
accept rate: 0%

edited 14 Apr '20, 09:05

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.

(12 Apr '20, 15:12) maxerickson

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:

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
(12 Apr '20, 21:51) jovokep

I've edited the whole question for greater clarity.

(12 Apr '20, 22:06) jovokep
2

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.

(13 Apr '20, 02:39) maxerickson

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.

(14 Apr '20, 09:10) jovokep

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

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:

×202
×142
×111
×60
×43

question asked: 12 Apr '20, 14:48

question was seen: 3,708 times

last updated: 14 Apr '20, 09:10

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum