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
24 ordering.
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 -i or --index-directory 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
37 under 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-directory/-i)
53 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 Call fsync after writing the output file to force flushing buf‐
104 fers to disk.
105
106 –generator=NAME
107 The name and version of the program generating the output file.
108 It will be added to the header of the output file. Default is
109 “osmium/” and the version of osmium.
110
111 -o, –output=FILE
112 Name of the output file. Default is `-' (STDOUT).
113
114 -O, –overwrite
115 Allow an existing output file to be overwritten. Normally
116 osmium will refuse to write over an existing file.
117
118 –output-header=OPTION=VALUE
119 Add output header option. This command line option can be used
120 multiple times for different OPTIONs. See the libosmium manual
121 for a list of available header options.
122
124 When the -i or –index-directory option is specified, index files named
125 nodes.idx, ways.idx, and relations.idx are read from and written to the
126 given directory together with a file called start_ids that contains the
127 start IDs set with –start-id/-s.
128
129 This can be used to force consistent mapping over several invocations
130 of osmium renumber, for instance when you want to remap an OSM data
131 file and a corresponding OSM change file.
132
133 The index files are in binary format, but you can print the indexes in
134 text format using the –show-index option:
135
136 osmium renumber -i idxdir --show-index node >nodes-index.txt
137 osmium renumber -i idxdir --show-index way >ways-index.txt
138 osmium renumber -i idxdir --show-index relation >relations-index.txt
139
141 osmium renumber exits with exit code
142
143 0 if everything went alright,
144
145 1 if there was an error processing the data, or
146
147 2 if there was a problem with the command line arguments.
148
150 osmium renumber needs quite a bit of main memory to keep the mapping
151 between old and new IDs. It is intended for small to medium sized
152 extracts. You will need more than 32 GB RAM to run this on a full
153 planet.
154
155 Memory use is at least 8 bytes per node, way, and relation ID in the
156 input file.
157
159 Renumber a PBF file and output to a compressed XML file:
160
161 osmium renumber -o ch.osm.bz2 germany.osm.pbf
162
163 Renumbering Germany currently (spring 2016) takes less than three min‐
164 utes and needs about 3 GB RAM.
165
166 Renumber a PBF file starting the node IDs at 1 (and counting upwards),
167 the way IDs at 100 and the relation IDs at -200 (and counting down‐
168 wards.
169
170 osmium renumber -o renumbered.osm.pbf -s 1,100,-200 athens.osm.pbf
171
172 Renumber an OSM file storing the indexes on disk:
173
174 osmium renumber -i. -o renumbered.osm data.osm
175
176 then rewrite a change file, too:
177
178 osmium renumber -i. -o renumbered.osc changes.osc
179
181 · osmium(1), osmium-file-formats(5), osmium-sort(1)
182
183 · Osmium website (https://osmcode.org/osmium-tool/)
184
186 Copyright (C) 2013-2018 Jochen Topf <jochen@topf.org>.
187
188 License GPLv3+: GNU GPL version 3 or later
189 <https://gnu.org/licenses/gpl.html>. This is free software: you are
190 free to change and redistribute it. There is NO WARRANTY, to the
191 extent permitted by law.
192
194 If you have any questions or want to report a bug, please go to
195 https://osmcode.org/contact.html
196
198 Jochen Topf <jochen@topf.org>.
199
200
201
202 1.10.0 OSMIUM-RENUMBER(1)