OSM file formats

From OpenStreetMap Wiki
Jump to navigation Jump to search


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


Overpass JSON

PBF o5m Discussion / comments
Osmium yes no yes read only use the Osmium command line tool or see osmium_convert in examples directory
osmconvert yes no yes yes own PBF implementation (does not use a library)
Osmosis yes no yes no software unmaintained but still in wide use
osm4j yes no yes no

Red x.svg To do: Add matrix which tool converts which format to which target format

Splitting one big file into different geographical regions

Filter for specific tags

File formats for diffs

Format Pros Cons Supported by
  • Streamable

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.

  • Doesn't indicate source of data
  • streamable
  • can be processed very fast (uses PBF like encoding, similar to .o5m format)
  • small file sizes even when not compressed
  • not human-readable
  • cannot be modified directly with texteditors
Augmented Diffs id-sorted version
  • streamable
  • real diff as before and after values are included
  • Supports placeholders
  • Indicates the source of the data
  • Not streamable

TODO: Insert content from XML#Flavours (pros + cons, etc)

Tools for applying diffs to map data files

Tools for creating diff files

Other variants of OSM map data

  • JOSM file format – non-indexed xml-format similar to the API
  • Spaten - 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.

Application specific formats which are not intended to carry complete OSM data

See also