1

Hello I have downloaded europe.osm.bz2 and I would like to exctract a large area using osmosis. Please forgive me for my ignorance, I am not a Linux / Unix at all and if I am missing something obvious, please advise.

I am ammending this script I found on the http://wiki.openstreetmap.org/wiki/Osmosis#Extracting_bounding_boxes.

Published script:

 bzcat downloaded.osm.bz2 | osmosis\
  --read-xml enableDateParsing=no file=/dev/stdin\
  --bounding-box top=49.5138 left=10.9351 bottom=49.3866 right=11.201 --write-xml file=-\
  | bzip2 > extracted.osm.bz2

My ammended script:

 bzcat.exe "I:\europe.osm.bz2" | osmosis.bat\
  --read-xml enableDateParsing=no file=CONIN$\
  --bounding-box top=51.2 left=11.7 bottom=47.6 right=23.0 --write-xml file=-\
  | bzip2 > "I:\czechoslovakia.osm.bz2"

Quite frankly I do not even know what the symbol really stands for and if it necessary on windows. I am assuming the | is some pipeline notification.

Here is what I am getting back.

bzcat.exe: I/O or other error, bailing out. Possible reason follows. bzcat.exe: Invalid argument Input file = I:europe.osm.bz2, output file = (stdout)

C:Mapyosmosis-0.38bin>--read-xml enableDateParsing=no file=CONIN$ '--read-xml' is not recognized as an internal or external command, operable program or batch file.

C:Mapyosmosis-0.38bin>--bounding-box top=51.2 left=11.7 bottom=47.6 right=23.0 --write-xml file=- '--bounding-box' is not recognized as an internal or external command, operable program or batch file. | was unexpected at this time.

Please advise.

asked 19 Jan '11, 13:47

Tomas%20Pajonk's gravatar image

Tomas Pajonk
1918817
accept rate: 0%


4 Answers:
1

It seems like you need to write everything on one line (or something). This is an error from DOS/Windows:

 '--bounding-box' is not recognized as an internal or external command, operable program or batch file. | was unexpected at this time.

Also I think you forgot the last pipe, try to just export to OSM (or pbf) and see if that works, so write it like this:

bzcat.exe "I:\europe.osm.bz2" | osmosis.bat --read-xml enableDateParsing=no file=CONIN$  --bounding-box top=51.2 left=11.7 bottom=47.6 right=23.0 --write-xml file="I:\czechoslovakia.osm"
permanent link

answered 20 Jan '11, 22:01

emj's gravatar image

emj
2.0k123447
accept rate: 15%

edited 20 Jan '11, 22:34

Why is bzcat used? I thought Osmosis could read .bz2 files anyway?

(25 Mar '11, 10:02) EdLoach ♦
1

running gz/bz2 as a separate task doesn't hurt and the Java implementations have been known to be buggy (e.g. java had/have problems with gzip concatenated streams).

(31 Mar '11, 21:11) emj
1

Instead of file=CONIN$ you have to use file"-" (see http://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage_0.39)

In my example i used 7-zip (bzcat should work as well when using -d -c as parameters)

c:Programme7-Zip7z.exe e -so I:AdminThomasosmxmleurope.osm.bz2 | D:OSMosmosisbinosmosis.bat --rx file="-" --tf accept-ways highway=motorway,trunk,primary --used-node --write-xml file="I:AdminThomasosmxmleuropa_einfach_highway.osm"

This extracts motorway, trunk and primary street from europe

permanent link

answered 25 Mar '11, 08:32

tmandel's gravatar image

tmandel
161
accept rate: 0%

0

All that I can reliably tell from that error message is that bzcat.exe (not osmosis) is unhappy. So this is not directly openstreetmap related. Check the documentation if the input filename should be I:/europe.osm.bz2 rather than I:europe.osm.bz2.

Also you might have to use bzip2.exe instead of bzip, but that is unrelated as it breaks down before it ever reaches that stage.

permanent link

answered 19 Jan '11, 13:55

petschge's gravatar image

petschge
8.0k207197
accept rate: 21%

When I supplied an incorect file name the error message was different.

(19 Jan '11, 14:08) Tomas Pajonk

I made a wrong call with the bzcat.exe. I should have called just bzcat.

(19 Jan '11, 14:09) Tomas Pajonk

I'd also recommend using europe.osm.pbf instead of .bz2, it's probably much faster to process by osmosis.

(19 Jan '11, 14:33) Breki

Would I then use Osmosis directly on the pbf or do I have to extract it somehow ?

(19 Jan '11, 14:50) Tomas Pajonk
0

Since this is more than a year old, I assume it is answered or not a problem. I agree however that the main problem is a Windows problem with the command syntax. For one thing, Windows commands cannot be continued.

permanent link

answered 24 May '12, 00:49

Sam%20Hobbs's gravatar image

Sam Hobbs
111
accept rate: 0%

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:

×228
×43

question asked: 19 Jan '11, 13:47

question was seen: 14,985 times

last updated: 24 May '12, 00:49

powered by OSQA