O'Reilly logo

OpenStreetMap by Jonathan Bennett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cutting out a bounding box

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
    --read-xml task.
    
    
  • It then extracts a bounding box using the --bounding-box task. As with other OpenStreetMap tools, the coordinates ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required