Newb needing help with street name list extraction

Here’s what I’m doing; I’m trying to export a list of street names from a polygon area on the map. It’s for setting up different delivery charges for each of the areas my restaurant delivers to. Thus far I’ve been able to select an area and export the osm to my hd. Now I’m at the part where I need to filter everything but street names and zip code(which will all be the same) but I’m not having much luck. When I put commands like others have used(osmfilter.exe map.osm --keep=“addr:country= and addr:city= and addr:street=” --ignore-dependencies >map2.osm & osmfilter.exe --keep=“highway=residential =primary =secondary =tertiaty =unclassified” --ignore-dependencies >map2.osm), I get errors:
osmfilter Warning: wrong sequence at way 10926600
osmfilter Warning: wrong sequence at way 10926119
osmfilter Warning: wrong sequence at way 10925942

After I can get past the above I need the data as .csv with the headings “StreetName,StreetZipcode”, which from what I have read can be done easily with osmconvert.

I truly appreciate any and all help with this.

Hello!

osmfilter cannot read from a pipe, hence the second call of osmfilter in your command line will not work.

Where do you have the input data (map.osm) from? It seems they had not been sorted by type and ID (as they usually should have been). However, this might not be a problem because you chose the --ignore-dependencies option. Try to get sorted data or just ignore the warning messages and check if the result is reasonable.

I went to openstreetmap.org, clicked the export tab, clicked manually select a different area then selected the area I’m trying to get a list of streets of. I exported it as OpenStreetMap XML Data.

I don’t understand what is meant by read from a pipe. I comprehend very little of any of this actually. The result of my file from earlier was I was able to get something output to csv but some lines are blank. im not sure if that is an error or not.

reading from a pipe in any commandline of an operating system means that you can connect two instructions with the “&” sign so that the second instruction reads the output from the first one.

Try to call osmfilter twice … maybe in a batch file … without the & sign.

Is it a pipe? I thought that the “&” is only combining two commands in same line and not combining first output to second input as normal pipe does.

However when you look at commands, there is something that bothers me:

  1. there is no input file defined to second osmfilter.exe call
  2. both commands write/redirect their output to same file map2.osm effectively overwriting each other

.

Hi,

You can do this task also with GDAL. You need the development version of GDAL. Driver manual page is http://www.gdal.org/ogr/drv_osm.html

Here is example of the usage. This command selects names and values of the highway tag from finland.osm.pbf file where highway has some value by using the given bounding box for filtering and writes the result into test.csv file.

GDAL_dev>ogr2ogr -f CSV test.csv finland.osm.pbf -sql “select name, highway from lines
where highway is not null” -spat 24.816 60.128 25.037 60.297

Beginning of the test.csv file

name,highway
Kehä III,trunk
Kehä III,trunk
Kehä III,trunk
,cycleway
Ulvilantie,tertiary
Taiteentekijäntie,residential
,service
Servin Maijan tie,residential

Running this command took 16 seconds with my laptop. Size of Finland.osm.pbf is 127 MB. You may find it hard to do the job faster.