← 返回命令列表

Linux command

osmium 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Extract area from OSM file

osmium extract -b [left],[bottom],[right],[top] [input.osm.pbf] -o [output.osm.pbf]

Convert format

osmium cat [input.osm.pbf] -o [output.osm.xml]

Merge multiple files

osmium merge [file1.osm.pbf] [file2.osm.pbf] -o [merged.osm.pbf]

Filter by tags

osmium tags-filter [input.osm.pbf] -o [output.osm.pbf] nwr/[highway]

Show file info

osmium fileinfo [file.osm.pbf]

Check file integrity

osmium check-refs [file.osm.pbf]

Sort OSM data

osmium sort [input.osm] -o [sorted.osm]

Get difference between files

osmium diff [old.osm.pbf] [new.osm.pbf]

Extract using polygon file

osmium extract -p [boundary.poly] [input.osm.pbf] -o [output.osm.pbf]

Apply an OsmChange file

osmium apply-changes [input.osm.pbf] [changes.osc] -o [output.osm.pbf]

说明

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.

参数

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.
apply-changes
Apply OsmChange file.
renumber
Renumber object IDs.
getid
Get objects by ID.
time-filter
Filter by timestamp.
-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.
--progress
Show progress bar.
-e _STRATEGY_, --strategy _STRATEGY_
Extraction strategy: simple, complete_ways, or smart.

FAQ

What is the osmium command used for?

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.

How do I run a basic osmium example?

Run `osmium extract -b [left],[bottom],[right],[top] [input.osm.pbf] -o [output.osm.pbf]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does cat do in osmium?

Concatenate/convert files.