osmium
command-line tool for working with OpenStreetMap data
TLDR
Extract area from OSM file
SYNOPSIS
osmium command [-o output] [options] files
DESCRIPTION
osmium is a command-line tool for working with OpenStreetMap data. It processes, filters, and transforms OSM files efficiently.
Extract creates regional subsets from larger files. Bounding boxes define rectangular areas. Polygon files enable extraction of complex shapes like administrative boundaries.
Tags-filter creates files containing only specific feature types. Tag expressions select highways, buildings, points of interest, or custom combinations.
Merging combines multiple files into one, handling overlapping data correctly. Files must be sorted for merging. The sort command prepares unsorted data.
Format conversion handles PBF (Protocol Buffer Binary), OSM XML, and OPL (Object Per Line) formats. PBF is compressed and efficient; XML is human-readable.
Diff shows changes between file versions, useful for tracking map edits over time.
PARAMETERS
cat
Concatenate/convert files.extract
Extract region from file.merge
Merge sorted files.tags-filter
Filter by tags.sort
Sort OSM data.diff
Compare files.fileinfo
Show file information.check-refs
Check referential integrity.-o FILE
Output file.-b BBOX
Bounding box (left,bottom,right,top).-p POLYGON
Polygon file for extraction.--overwrite
Overwrite existing output.-f FORMAT
Output format.-v, --verbose
Verbose output.
CAVEATS
Large files require significant memory. Some operations need sorted input. Extraction may include incomplete relations. Complex filters have learning curve.
HISTORY
osmium and the libosmium library were developed by Jochen Topf starting around 2013. It became the standard command-line tool for OSM data processing, replacing older tools with better performance and reliability.
SEE ALSO
osm2pgsql(1), osmconvert(1), ogr2ogr(1)
