Skip to content
nvkelso edited this page Oct 19, 2012 · 6 revisions

#Clipping out a bbox area of interest:

One of the basic use cases is extracting a subset of OSM XML from a large downloaded file. You might have downloaded the world OSM (planet.osm) and want to extract some region, or maybe you have a country extract downloaded but only want one city. The simplest way to do that is by extracting a rectangle.

An example that extracts Nürnberg and some area around it from Germany - or maybe world - OSM:

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

#For merging and importing OSM data:

osmosis --rx berlin.osm.bz2 --rx new-york.osm.bz2 --rx paris.osm.bz2 --rx london.osm.bz2 --merge --merge --merge --log-progress --wx merged.osm.bz2

NEXT: Import the result via osm2pgsql to load into PostGIS.

Read more at the manual page »

Clone this wiki locally