OSM file formats
Jump to navigation
Jump to search
Map Data
The most important formats are:
- PBF Format – highly compressed, optimized binary format similar to the API, recommended for data processing
- OSM XML – XML format provided by the API. Please use PBF if you can.
- OSM JSON – JSON format provided by the API, based on Overpass API JSON format.
- o5m – for high-speed processing, uses PBF coding, has same structure as XML format, limited support by applications
- Overpass JSON – JSON variant of OSM XML, used by Overpass API
- Level0L – more human readable OSM XML without <> and lowered redundancy
- OPL – "One Per Line" each OSM object is on its own line with a newline character at the end
Conversion between different OSM map data formats
For converting OSM file formats to and from other geospatial formats (such as GeoJSON or GPX), see converting map data between formats.
Converting To | Notes | ||||||||
---|---|---|---|---|---|---|---|---|---|
o5m | OPL | OSM JSON | OSM XML | Overpass JSON | PBF | ||||
Osmium (C++) | Converting
From |
o5m | no | yes | no | yes | no | yes | use the Osmium command line tool or see osmium_convert in examples directory
Osmium supports exporting data to a few other formats, see here for the full list. |
OPL | no | yes | no | yes | no | yes | |||
OSM XML | no | yes | no | yes | no | yes | |||
PBF | no | yes | no | yes | no | yes | |||
osmconvert (C) | o5m | yes | yes | no | yes | no | yes | own PBF implementation (does not use a library) | |
OSM XML | yes | yes | no | yes | no | yes | |||
PBF | yes | yes | no | yes | no | yes | |||
Osmosis (Java) | o5m | no | no | no | yes | no | yes | software unmaintained but still in wide use | |
OSM XML | no | no | no | yes | no | yes | |||
PBF | no | no | no | yes | no | yes | |||
osm4j (Java) | o5m | no | no | no | yes | no | yes | ||
OSM XML | no | no | no | yes | no | yes | |||
PBF | no | no | no | yes | no | yes | |||
osm (Go library) | OSM XML | no | no | yes | yes | yes | no | ||
OSM JSON | no | no | yes | yes | yes | no | |||
Overpass JSON | no | no | yes | yes | yes | no | |||
PBF | no | no | yes | yes | yes | no | |||
skyway (Rust) | OPL | no | yes | yes | yes | yes | no | skyway is a nascent project and is not ready for production use. | |
OSM JSON | no | yes | yes | yes | yes | no | |||
OSM XML | no | yes | yes | yes | yes | no | |||
Overpass JSON | no | yes | yes | yes | yes | no | |||
PBF | no | yes | yes | yes | yes | no |
Splitting one big file into different geographical regions
- Osmium command line tool (using the extract command), most performant
- Osmosis (unmaintained)
- osmconvert
- osmsplit
- splitter (used as preprocessing step to create maps for Garmin GPS receivers)
Filter for specific tags
- Osmosis (unmaintained)
- osmfilter
- Osmium Tool "tags-filter" command
File formats for diffs
Format | Pros | Cons | Supported by |
---|---|---|---|
OsmChange |
When sorted properly this file is a continuous stream of changes that can be played in order. In osmosis the option --sort-change will put the change into streamable order. |
|
|
o5c |
|
|
|
Augmented Diffs id-sorted version |
|
| |
JOSM_file_format |
|
|
TODO: Insert content from XML#Flavours (pros + cons, etc)
Tools for applying diffs to map data files
- Osmium command line tool (use the "apply-changes" command)
- pyosmium-up-to-date can download diffs and apply them to a planet file or regional extract
- osmconvert
- osmupdate
- Osmosis (unmaintained)
Tools for creating diff files
- Osmium command line tool (use the "derive-changes" command)
- osmconvert
- Osmosis (unmaintained)
Other variants of OSM map data
- JOSM file format – non-indexed xml-format similar to the API
- Spaten – format by Thomas Skowron (based on PBF and WKB)
- OSM Express – on-disk format based on LMDB and S2
- mapsplit – compact tiled raw OSM data in pbf format suitable for editors and other applications that need fast, offline access.
- Geographic Object Library (GOL) – compact single-file database that supports fast MapCSS-like queries
Application-specific formats which are not intended to carry complete OSM data:
- OSMbin (file format) – indexed, mutable binary format
- OSM Mobile Binary Format – read-only binary-format without nodes
- OBF – native format of OsmAnd