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

I'm trying to extract the street name of a city from an osm file (converted from pbf) that I got from geofabrik. I used osmfilter and osmconvert for the extraction, using this command:

osmfilter indonesia-latest.osm --keep="addr:country= and addr:city=Bandung and addr:street=" --ignore-dependencies --drop-relations --drop-ways |osmconvert64 - --csv="@oname @id @lon @lat addr:country addr:city addr:street" > street.csv

this is the result:

"node   2756741420  107.6338734 -6.9156038  ID  Bandung Jalan Jenderal Ahmad Yani"
"node   3809732416  107.6065560 -6.9319114  ID  Bandung Jalan Muhammad Toha"
"node   6003232946  107.5775460 -6.9723688  ID  Bandung Jalan Sukamenak"

The problem is, those 3 streets are the only ones extracted in the csv. Is there something wrong with my command or is it the source data? Are there any alternative ways for extraction?

asked 19 Sep '20, 03:21

ceeslt's gravatar image

ceeslt
11224
accept rate: 0%

2

What data are you hoping to obtain? The OSM information for the street itself? The OSM information for things which have an address on that street? Something else?

(19 Sep '20, 12:12) SomeoneElse ♦
1

I was just looking for the names of the street. Sorry I missed your comment all this time.

(08 Oct '20, 10:36) ceeslt

I know very little about osmosis, but from a data perspective:

You appear to be searching for addresses rather than the names of the streets themselves. In most parts of the world OSM has far better coverage of street names than they do addresses.

Street names are usually recorded as name=* on ways representing the street. Streets, tracks and paths all have the same highway key in openstreetmap, see this page for a list of values. If your osm file covers more area than you are interested in you will need to get osmosis to only look within that subregion (I can't help with this except to direct you here).

If you actually want the list of streets that have at least one address then you are being a little too restrictive in your query. The addr:country= tag is often omitted entirely as this can usually be inferred from the border. In regions with higher detail the addr:city field can also be left off for the same reason. If you follow this approach you should also look at ways and relations as whole buildings or properties may be tagged with addresses instead of just tagging a POI node within the area.

permanent link

answered 19 Sep '20, 12:00

InsertUser's gravatar image

InsertUser
11.0k1369185
accept rate: 19%

how do you call the name of the street? I tried

osmfilter indonesia-latest.osm --keep="addr:city=Bandung and addr:street amd name= highway=*" |osmconvert64 - --csv="@id @name" --csv-separator="|" > streetlist.csv

but it doesn't seem to work. (sorry, I'm new with these)

(01 Oct '20, 12:40) ceeslt
2

You might benefit from looking at examples of the underlying data and considering whether your query would find them.

Here are the details of a street (or rather a segment of a street) in Bandung: https://www.openstreetmap.org/way/319194433

If you look at the tags, you can see that it is mapped as highway=primary, and the name is in the "name=" field. There are no addr: tags, which is normal - we would expect addr: tags to apply to buildings and other things located on the street, not the street itself (like this hotel for example: https://www.openstreetmap.org/way/372063342#map=19/-6.92049/107.60480). So if you are looking for highway= objects, you should not have any addr: tags in the query. You would need to restrict the are to Bandung in a different way, but I don't know enough about the tools you are using to say how.

(01 Oct '20, 16:38) alan_gr

Thank you, now I can understand what I'm looking for data-wise, though since there doesn't seem to be a property that signifies the region(city, province, etc) of the street I'm still looking for ways to filter it.

(05 Oct '20, 04:38) ceeslt

Ok, I managed to slice the osm file to contain just the city I'm extracting so there's no need for the addr tag, but I still can't call the name tag. I've tried @name, name, name=*. and highway:name but still can't get anything.

(08 Oct '20, 02:15) ceeslt

I am not sure what you mean by "call the name tag". Do your mean you want to filter by name? I am not clear why, as I thought you wanted all names on highway= objects? When you say you can't get anything, do you mean that nothing is written to the csv file, or that the name tag is missing?

(08 Oct '20, 08:05) alan_gr

Sorry for my wording, I meant extract the name tag of the streets to write in the csv output, to produce a list of street names. So far the things I've tried have only returned empty results.

(08 Oct '20, 08:29) ceeslt
showing 5 of 6 show 1 more comments

Nevermind, I did it using

osmfilter bandung.osm --keep="highway=*" |osmconvert64 - --csv="@id name" --csv-separator="|" > jalan.csv

THanks for explaining how osm works!

permanent link

answered 08 Oct '20, 10:34

ceeslt's gravatar image

ceeslt
11224
accept rate: 0%

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:

×111
×60
×47
×42
×13

question asked: 19 Sep '20, 03:21

question was seen: 1,718 times

last updated: 08 Oct '20, 10:36

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