LinuxCommandLibrary

osmium

Process and convert OpenStreetMap data

TLDR

Show file information

$ osmium fileinfo [path/to/input.osm]
copy

Display contents
$ osmium show [path/to/input.osm]
copy

Convert file format from PBF into XML
$ osmium cat [path/to/input.osm.pbf] [[-o|--output]] [path/to/output.osm]
copy

Extract a geographic region by the given [b]ounding box
$ osmium extract [[-b|--bbox]] [min_longitude],[min_latitude],[max_longitude],[max_latitude] [path/to/input.pbf] [[-o|--output]] [path/to/output.pbf]
copy

Extract a geographic region by a GeoJSON file
$ osmium extract [[-p|--polygon]] [path/to/polygon.geojson] [path/to/input.pbf] [[-o|--output]] [path/to/output.pbf]
copy

Filter all objects tagged as "restaurant"
$ osmium tags-filter [path/to/input.pbf] amenity=restaurant [[-o|--output]] [path/to/output.pbf]
copy

Filter for "way" objects tagged as "highway"
$ osmium tags-filter [path/to/input.pbf] w/highway [[-o|--output]] [path/to/output.pbf]
copy

Filter "way" and "relation" objects tagged as "building"
$ osmium tags-filter [path/to/input.pbf] wr/building [[-o|--output]] [path/to/output.pbf]
copy

SYNOPSIS

osmium command [ options ]

PARAMETERS

help
    Show help message and exit.

version
    Show program's version number and exit.

input-format
    Specify the input format (e.g., xml, pbf, o5m, o5c). Autodetection is usually sufficient.

output-format
    Specify the output format (e.g., xml, pbf, o5m, o5c).

verbose
    Increase verbosity of output.

DESCRIPTION

Osmium is a command-line tool and C++ library for working with OpenStreetMap (OSM) data. It's designed for efficient processing of large OSM files in various formats, including XML, PBF, and O5M/O5C. Osmium provides functionalities like filtering, converting, and inspecting OSM data. It allows developers and data analysts to manipulate OSM datasets, extract specific features, and prepare data for further analysis or import into databases. Osmium is often used in conjunction with other OSM tools to build complex data processing pipelines. Osmium stands out for its speed and memory efficiency, enabling it to handle even the largest OSM planet files with reasonable resources. Its flexible command-line interface and comprehensive C++ API make it a versatile tool for diverse OSM data manipulation tasks.

CAVEATS

Osmium requires a good understanding of OSM data structure and its specific commands. Incorrect usage can lead to data corruption or unexpected results. It is not a single 'do everything' tool, it must be properly configured.
Some operations can be very resource-intensive depending on the size of the OSM data. Consider using the appropriate data formats and filter techniques to improve efficiency.

SUBCOMMANDS

Osmium provides various subcommands for different tasks, such as:
fileinfo: Shows information about an OSM file.
extract: Extracts a portion of an OSM file based on a bounding box or polygon.
tags-filter: Filters OSM objects based on their tags.
merge: Merge multiple OSM files.

DATA FORMATS

Osmium supports several OSM data formats:
XML: The original OSM XML format. Less efficient for large files.
PBF: Protocolbuffer Binary Format. More compact and efficient than XML.
O5M/O5C: Optimized binary formats for faster processing.

HISTORY

Osmium was developed to address the need for a fast and efficient tool for processing large OSM datasets. The initial development focused on creating a C++ library that could handle the complexities of the OSM data model and formats. Over time, a command-line interface was added to provide a user-friendly way to access the library's functionalities. The tool's development continues to incorporate improvements in performance, memory management, and support for new OSM features. The initial developers are still active in the OpenStreetMap community. Osmium is widely used in various OSM-related projects, including routing, data analysis, and map rendering.

SEE ALSO

osmconvert(1), osmfilter(1), osmupdate(1)

Copied to clipboard