One of the simplest tasks is to cut out a bounding box from a planet (or other) file to get data for a specific region. Let's use Iceland as our example, as we did with XAPI in the previous chapter. To extract the data of Iceland from a planet file, use the following command:
bzcat planet-100428.osm.bz2 | osmosis --read-xml file=/dev/stdin --bounding-box left="-25.09" right="-12.55" top="67.42" bottom="62.94" --write-xml file="iceland.osm.bz2"
The command uses three tasks to process the data. They are as follows:
Osmosis reads the data in from a planet file from April 28, 2010 using the
It then extracts a bounding box using the
--bounding-box
task. As with other OpenStreetMap tools, the coordinates for the bounding box are supplied in WGS84 degrees.Finally, it writes the results to a file named
iceland.osm.bz2
, using the
Normally, Osmosis works directly with bzip2-compressed files, and is able to detect...