1OSMIUM-RENUMBER(1) OSMIUM-RENUMBER(1)
2
3
4
6 osmium-renumber - renumber object IDs
7
9 osmium renumber [OPTIONS] OSM-DATA-FILE
10
12 The objects (nodes, ways, and relations) in an OSM file often have very
13 large IDs. This can make some kinds of postprocessing difficult. This
14 command will renumber all objects using IDs starting at 1. Referential
15 integrity will be kept. All objects which appear in the source file
16 will be in the same order in the output file. IDs of objects which are
17 not in the file but referenced from ways or relations are not guaran‐
18 teed to be in the correct order.
19
20 This command expects the input file to be ordered in the usual way:
21 First nodes in order of ID, then ways in order of ID, then relations in
22 order of ID. Negative IDs are allowed, they must be ordered before the
23 positive IDs. See the osmium-sort(1) man page for details of the or‐
24 dering.
25
26 The input file will be read twice, so it will not work with STDIN. If
27 you are not renumbering relations (ie. if the option --object-type/-t
28 is used with nodes and/or ways but not relations) the input file will
29 only be read once, so in that case it will work with STDIN.
30
31 To renumber the IDs in several files, call osmium renumber for each
32 file and specify the --index-directory/-i option each time. See the
33 INDEX FILES section for more details.
34
35 You must never upload the data generated by this command to OSM! This
36 would really confuse the OSM database because it knows the objects un‐
37 der different IDs.
38
40 -i, --index-directory=DIR
41 Directory where the index files for mapping between old and news
42 IDs are read from and written to, respectively. Use this if you
43 want to map IDs in several OSM files. Without this option, the
44 indexes are not read from or written to disk. The directory
45 must exist. Use `.' for the current directory. The files writ‐
46 ten will be named nodes.idx, ways.idx, and relations.idx. See
47 also the INDEX FILES section below.
48
49 --show-index=TYPE
50 Print the content of the index for TYPE (node, way, or relation)
51 on STDOUT. Each line contains the old ID, a space character and
52 then the new ID. Any other options (except --index-direc‐
53 tory/-i) are ignored if this option is used.
54
55 -s, --start-id=FIRST_ID or FIRST_NODE_ID,FIRST_WAY_ID,FIRST_RELATION_ID
56 Set the first ID that should be used. If the ID is positive,
57 IDs are counted upwards, if the ID is negative, they are counted
58 downwards. This can be set to either a single ID which is used
59 for all object types or a comma-separated list of three IDs used
60 for the first node, way, and relation, respectively. If this is
61 not set, IDs for all object types start at 1.
62
63 -t, --object-type=TYPE
64 Renumber only objects of given type (node, way, or relation).
65 By default all objects of all types are renumbered. This option
66 can be given multiple times.
67
69 -h, --help
70 Show usage help.
71
72 -v, --verbose
73 Set verbose mode. The program will output information about
74 what it is doing to STDERR.
75
76 --progress
77 Show progress bar. Usually a progress bar is only displayed if
78 STDOUT and STDERR are detected to be TTY. With this option a
79 progress bar is always shown. Note that a progress bar will
80 never be shown when reading from STDIN or a pipe.
81
82 --no-progress
83 Do not show progress bar. Usually a progress bar is displayed
84 if STDOUT and STDERR are detected to be a TTY. With this option
85 the progress bar is suppressed. Note that a progress bar will
86 never be shown when reading from STDIN or a pipe.
87
89 -F, --input-format=FORMAT
90 The format of the input file(s). Can be used to set the input
91 format if it can’t be autodetected from the file name(s). This
92 will set the format for all input files, there is no way to set
93 the format for some input files only. See osmium-file-for‐
94 mats(5) or the libosmium manual for details.
95
97 -f, --output-format=FORMAT
98 The format of the output file. Can be used to set the output
99 file format if it can’t be autodetected from the output file
100 name. See osmium-file-formats(5) or the libosmium manual for
101 details.
102
103 --fsync
104 Call fsync after writing the output file to force flushing buf‐
105 fers to disk.
106
107 --generator=NAME
108 The name and version of the program generating the output file.
109 It will be added to the header of the output file. Default is
110 “osmium/” and the version of osmium.
111
112 -o, --output=FILE
113 Name of the output file. Default is `-' (STDOUT).
114
115 -O, --overwrite
116 Allow an existing output file to be overwritten. Normally os‐
117 mium will refuse to write over an existing file.
118
119 --output-header=OPTION=VALUE
120 Add output header option. This command line option can be used
121 multiple times for different OPTIONs. See the osmium-output-
122 headers(5) man page for a list of available header options. For
123 some commands you can use the special format “OPTION!” (ie. an
124 exclamation mark after the OPTION and no value set) to set the
125 value to the same as in the input file.
126
128 When the --index-directory/-i option is specified, index files named
129 nodes.idx, ways.idx, and relations.idx are read from and written to the
130 given directory together with a file called start_ids that contains the
131 start IDs set with --start-id/-s.
132
133 This can be used to force consistent mapping over several invocations
134 of osmium renumber, for instance when you want to remap an OSM data
135 file and a corresponding OSM change file.
136
137 The index files are in binary format, but you can print the indexes in
138 text format using the --show-index option:
139
140 osmium renumber -i idxdir --show-index node >nodes-index.txt
141 osmium renumber -i idxdir --show-index way >ways-index.txt
142 osmium renumber -i idxdir --show-index relation >relations-index.txt
143
145 osmium renumber exits with exit code
146
147 0 if everything went alright,
148
149 1 if there was an error processing the data, or
150
151 2 if there was a problem with the command line arguments.
152
154 osmium renumber needs quite a bit of main memory to keep the mapping
155 between old and new IDs. It is intended for small to medium sized ex‐
156 tracts. You will need more than 32 GB RAM to run this on a full
157 planet.
158
159 Memory use is at least 8 bytes per node, way, and relation ID in the
160 input file.
161
163 Renumber a PBF file and output to a compressed XML file:
164
165 osmium renumber -o ch.osm.bz2 germany.osm.pbf
166
167 Renumbering the about 3.3 GB Germany PBF file currently (February 2020)
168 takes about three minutes and needs about 7 GB RAM.
169
170 Renumber a PBF file starting the node IDs at 1 (and counting upwards),
171 the way IDs at 100 and the relation IDs at -200 (and counting down‐
172 wards.
173
174 osmium renumber -o renumbered.osm.pbf -s 1,100,-200 athens.osm.pbf
175
176 Renumber an OSM file storing the indexes on disk:
177
178 osmium renumber -i. -o renumbered.osm data.osm
179
180 then rewrite a change file, too:
181
182 osmium renumber -i. -o renumbered.osc changes.osc
183
185 • osmium(1), osmium-file-formats(5), osmium-output-headers(5), osmium-
186 sort(1)
187
188 • Osmium website (https://osmcode.org/osmium-tool/)
189
191 Copyright (C) 2013-2022 Jochen Topf <jochen@topf.org>.
192
193 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/li‐
194 censes/gpl.html>. This is free software: you are free to change and
195 redistribute it. There is NO WARRANTY, to the extent permitted by law.
196
198 If you have any questions or want to report a bug, please go to
199 https://osmcode.org/contact.html
200
202 Jochen Topf <jochen@topf.org>.
203
204
205
206 1.14.0 OSMIUM-RENUMBER(1)