🆕Working with OpenStreetMap files
Last updated
Last updated
A lot of routing software used in the OpenStreetMap (OSM) project supports Protocolbuffer Binary Format (PBF). There are several tools to convert from PBF to OSM XML and vice versa, if required, including Osmconvert, Osmosis and Osmium:
OSM files are usually sorted in a specific way: first the nodes ordered by ID, then ways ordered by ID, then relations ordered by ID. But this is not necessarily always the case.
It is important to check if a file is sorted correctly as many commands only work properly if a file is sorted.
To check if a file is sorted, in Osmium use fileinfo
:
To sort a file using Osmium:
To sort a file using Osmosis:
Tool
Description
Functionality
Example
Lightweight (but fast) application to convert and process OSM files.
Basic
osmconvert OSMulti-modalRoutingNetwork.pbf >OSMulti-modalRoutingNetwork.osm
Command-line application for processing OSM data.
Intermediate
osmosis --read-pbf OSMulti-modalRoutingNetwork.pbf --write-xml OSMulti-modalRoutingNetwork.osm
Multipurpose command-line tool based on the Osmium Library.
Advanced
osmium cat OSMulti-modalRoutingNetwork.pbf -o OSMulti-modalRoutingNetwork.osm