I want to cut extracts from planet.osm.bz2 . I have found this command

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

Only concern I have the disc space. planet.osm uncompressed is 400GB!

How much space would use this command from WIKI?


The best way is to use the planet.osm.pbf dump, which is a binary format and substantially faster than bzipped XML.

You should also use Osmconvert instead of osmosis for a task like this.

A suitable command would be

osmconvert planet-latest.osm.pbf -b=10.5,49,11.5,50 -o=nuernberg.osm.pbf

This will create a PBF file, which is quicker to process than bzipped XML. Another way to speed the process up is to start with an extract from geofabrik that contains the area you need. If you're only after a city, downloading the Country or State extract for the region is faster than downloading the planet file.

  • Does pbf format keep all data that exists in osm.bz2? Especially amenities... ??? – MR.GEWA Apr 20 '14 at 12:21
  • PBF is just a binary representation of OSM data, like OSM XML is. They both contain the same data. Within that data are the key=value pairs that make up tags. – Paul Norman Apr 23 '14 at 3:38
  • I can't get it to work with history files. – Max von Hippel Oct 30 '16 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.