This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Crop or shrink OSM file to given bbox

0

Is there a command line tool, which will allow to cut existing osm file data and keep only all relevant data to a given bbox? Lets say we have an OSM file for a given country, I want to make it smaller and only keep some smaller bbox area as OSM data with all it relations and POIs Any help here?

Thanks to @jonathan-bennett

 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

asked 20 Sep '13, 13:38

Gevork's gravatar image

Gevork
234121422
accept rate: 0%

edited 20 Sep '13, 13:50


2 Answers:

4

Osmosis, a command-line Java application, will do this and more.

answered 20 Sep '13, 13:42

Jonathan%20Bennett's gravatar image

Jonathan Ben...
8.3k1785108
accept rate: 18%

1

Also try osmconvert.

answered 22 Sep '13, 10:33

stephan75's gravatar image

stephan75
12.6k556210
accept rate: 6%

Source code available on GitHub .