1OSMIUM-FILE-FORMATS(5) OSMIUM-FILE-FORMATS(5)
2
3
4
6 osmium-file-formats - OSM file formats known to Osmium
7
9 OSM uses three types of files for its main data:
10
11 Data files
12 These are the most common files. They contain the OSM data from
13 a specific point in time. This can either be a planet file con‐
14 taining all OSM data or some kind of extract. At most one ver‐
15 sion of every object (node, way, or relation) is contained in
16 this file. Deleted objects are not in this file. The usual
17 suffix used is .osm.
18
19 History files
20 These files contain not only the current version of an object,
21 but their history, too. So for any object (node, way, or rela‐
22 tion) there can be zero or more versions in this file. Deleted
23 objects can also be in this file. The usual suffix used is .osm
24 or .osh. Because sometimes the same suffix is used as for nor‐
25 mal data files (.osm) and because there is no clear indicator in
26 the header, it is not always clear what type of file you have in
27 front of you.
28
29 Change files
30 Sometimes called diff files or replication diffs these files
31 contain the changes between one state of the OSM database and
32 another state. Change files can contains several versions of an
33 object and also deleted objects. The usual suffix used is .osc.
34
35 All these files have in common that they contain OSM objects (nodes,
36 ways, and relations). History files and change files can contain sev‐
37 eral versions of the same object and also deleted objects, data files
38 can’t.
39
40 Where possible, Osmium commands can handle all file types. For some
41 commands only some file types make sense.
42
44 The osmium command line tool supports all major OSM file formats plus
45 some more. These are:
46
47 • The classical XML format in the variants .osm (for data files), .osh
48 (for data files with history) and .osc (for change files).
49
50 • The PBF binary format (usually with suffix .osm.pbf or just .pbf).
51
52 • The OPL format (usually with suffix .osm.opl or just .opl).
53
54 • The O5M/O5C format (usually with suffix .o5m or .o5c) (reading only).
55
56 • The “debug” format (usually with suffix .osm.debug) (writing only).
57
58 In addition files in all formats except PBF can be compressed using
59 gzip or bzip2. (Add .gz or .bz2 suffixes, respectively.)
60
62 Which format a file has is usually autodetected from the file name suf‐
63 fix.
64
65 If this doesn’t work, either because you are reading from STDIN or
66 writing to STDOUT, or because you have an unusual file name, you have
67 to set the format manually. You can also set the format manually if
68 you want to specify special format options.
69
70 Most osmium commands support the --input-format/-F and --output-for‐
71 mat/-f options to set the format. They take a comma-separated list of
72 arguments, the first is the format, further arguments set additional
73 options.
74
76 The following options can be added when writing OSM files:
77
78 xml_change_format=true/false
79 Enable/disable XML change format. Same as .osc.
80
81 force_visible_flag=true/false (default: false)
82 Force writing of visible flag, even for normal OSM XML files.
83
84 pbf_dense_nodes=true/false (default: true)
85 Enable/disable DenseNodes format for PBF files.
86
87 pbf_compression=none/zlib/lz4 (default: zlib)
88 Set compression type in PBF files. zlib (or true) is the de‐
89 fault and almost all files use this. none (or false) disables
90 compression which will make writing files a bit faster, but the
91 resulting files are 2 to 3 times bigger. The lz4 compression is
92 not quite as good as zlib but much faster to compress and decom‐
93 press, it is currently not supported by most OSM file readers.
94
95 pbf_compression_level=...
96 Set compression level for PBF. Available values and default de‐
97 pend on the compression type used, see the OSM File Formats Man‐
98 ual for details.
99
100 add_metadata=true/false/... (default: true)
101 Enable/disable writing of object metadata such as changeset id,
102 username, etc. Disabling this will make files a bit smaller.
103 This can also be set to other values, see the OSM File Formats
104 Manual for details.
105
106 locations_on_ways=true/false (default: false)
107 Add node locations to way nodes. (PBF, XML, OPL only.)
108
109 use_color=true/false (default: false)
110 Output with ANSI colors. (DEBUG format only.)
111
112 add_crc32=true/false (default: false)
113 Add CRC32 checksum to all objects. (DEBUG format only.)
114
116 Here are some examples:
117
118 pbf PBF format.
119
120 pbf,add_metadata=false
121 PBF format, don’t write metadata
122
123 osm.bz2
124 XML format, compressed with bzip2.
125
126 osc.gz OSM change file, compressed with gzip.
127
128 osm.gz,xml_change_format=true
129 OSM change file, compressed with gzip.
130
131 osh.opl
132 OSM history file in OPL format.
133
135 • osmium(1)
136
137 • Osmium website (https://osmcode.org/osmium-tool/)
138
139 • OSM File Formats Manual (https://osmcode.org/file-formats-manual/)
140
142 Copyright (C) 2013-2023 Jochen Topf <jochen@topf.org>.
143
144 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/li‐
145 censes/gpl.html>. This is free software: you are free to change and
146 redistribute it. There is NO WARRANTY, to the extent permitted by law.
147
149 If you have any questions or want to report a bug, please go to
150 https://osmcode.org/contact.html
151
153 Jochen Topf <jochen@topf.org>.
154
155
156
157 1.16.0 OSMIUM-FILE-FORMATS(5)