.TH "OSMIUM-FILE-FORMATS" "5" "1.10.0" "" "" .SH NAME .PP osmium\-file\-formats \- OSM file formats known to Osmium .SH FILE TYPES .PP OSM uses three types of files for its main data: .TP .B \f[B]Data files\f[] These are the most common files containing the OSM data at a specific point in time. This can either be a planet file containing \f[I]all\f[] OSM data or some kind of extract. At most one version of every object (node, way, or relation) is contained in this file. Deleted objects are \f[I]not\f[] in this file. The usual suffix used is \f[C]\&.osm\f[]. .RS .RE .TP .B \f[B]History files\f[] These files contain not only the current version of an object, but their history, too. So for any object (node, way, or relation) there can be zero or more versions in this file. Deleted objects can also be in this file. The usual suffix used is \f[C]\&.osm\f[] or \f[C]\&.osh\f[]. Because sometimes the same suffix is used as for normal data files (\f[C]\&.osm\f[]) and because there is no clear indicator in the header, it is not always clear what type of file you have in front of you. .RS .RE .TP .B \f[B]Change files\f[] Sometimes called \f[I]diff files\f[] or \f[I]replication diffs\f[] these files contain the changes between one state of the OSM database and another state. Change files can contains several versions of an object. The usual suffix used is \f[C]\&.osc\f[]. .RS .RE .PP All these files have in common that they contain OSM objects (nodes, ways, and relations). History files and change files can contain several versions of the same object and also deleted objects, data files can\[aq]t. .PP Where possible, Osmium commands can handle all file types. For some commands only some file types make sense. .SH FORMATS .PP The \f[B]osmium\f[] command line tool supports all major OSM file formats plus some more. These are: .IP \[bu] 2 The classical XML format in the variants \f[I]\&.osm\f[] (for data files), \f[I]\&.osh\f[] (for data files with history) and \f[I]\&.osc\f[] (for change files). .IP \[bu] 2 The PBF binary format (usually with suffix \f[I]\&.osm.pbf\f[] or just \f[I]\&.pbf\f[]). .IP \[bu] 2 The OPL format (usually with suffix \f[I]\&.osm.opl\f[] or just \f[I]\&.opl\f[]). .IP \[bu] 2 The O5M/O5C format (usually with suffix \f[I]\&.o5m\f[] or \f[I]\&.o5c\f[]) (reading only). .IP \[bu] 2 The "debug" format (usually with suffix \f[I]\&.osm.debug\f[]) (writing only). .PP In addition files in all formats except PBF can be compressed using \f[I]gzip\f[] or \f[I]bzip2\f[]. (Add \f[I]\&.gz\f[] or \f[I]\&.bz2\f[] suffixes, respectively.) .SH AUTODETECTION .PP Which format a file has is usually autodetected from the file name suffix. .PP If this doesn\[aq]t work, either because you are reading from STDIN or writing to STDOUT, or because you have an unusual file name, you have to set the format manually. You can also set the format manually if you want to specify special format options. .PP Most \f[B]osmium\f[] commands support the \f[B]\-\-input\-format\f[] (\f[B]\-\-F\f[]) and \f[B]\-\-output\-format\f[] (\f[B]\-f\f[]) options to set the format. They take a comma\-separated list of arguments, the first is the format, further arguments set additional options. .SH SPECIAL FORMAT OPTIONS .PP The following options can be added when writing OSM files: .TP .B \f[C]xml_change_format\f[]=\f[C]true\f[]/\f[C]false\f[] Enable/disable XML change format. Same as \f[I]\&.osc\f[]. .RS .RE .TP .B \f[C]force_visible_flag\f[]=\f[C]true\f[]/\f[C]false\f[] (\f[I]default: false\f[]) Force writing of visible flag, even for normal OSM XML files. .RS .RE .TP .B \f[C]pbf_dense_nodes\f[]=\f[C]true\f[]/\f[C]false\f[] (\f[I]default: true\f[]) Enable/disable DenseNodes format for PBF files. .RS .RE .TP .B \f[C]pbf_compression\f[]=\f[C]true\f[]/\f[C]false\f[] (\f[I]default: true\f[]) Enable/disable compression in PBF files. Disabling this will make writing files a bit faster, but the resulting files are 2 to 3 times bigger. .RS .RE .TP .B \f[C]add_metadata\f[]=\f[C]true\f[]/\f[C]false\f[] (\f[I]default: true\f[]) Enable/disable writing of object metadata such as changeset id, username, etc. Disabling this will make files a bit smaller. .RS .RE .SH EXAMPLES .PP Here are some examples: .TP .B \f[C]pbf\f[] PBF format. .RS .RE .TP .B \f[C]pbf,add_metadata=false\f[] PBF format, don\[aq]t write metadata .RS .RE .TP .B \f[C]osm.bz2\f[] XML format, compressed with bzip2. .RS .RE .TP .B \f[C]osc.gz\f[] OSM change file, compressed with gzip. .RS .RE .TP .B \f[C]osm.gz,xml_change_format=true\f[] OSM change file, compressed with gzip. .RS .RE .TP .B \f[C]osh.opl\f[] OSM history file in OPL format. .RS .RE .SH SEE ALSO .IP \[bu] 2 \f[B]osmium\f[](1) .IP \[bu] 2 Osmium website (https://osmcode.org/osmium-tool/) .IP \[bu] 2 OSM File Formats Manual (https://osmcode.org/file-formats-manual/) .SH COPYRIGHT .PP Copyright (C) 2013\-2018 Jochen Topf . License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. .SH CONTACT .PP If you have any questions or want to report a bug, please go to https://osmcode.org/contact.html .SH AUTHORS Jochen Topf .