1OSMIUM-GETID(1) OSMIUM-GETID(1)
2
3
4
6 osmium-getid - get objects from OSM file by ID
7
9 osmium getid [OPTIONS] OSM-FILE ID...
10 osmium getid [OPTIONS] OSM-FILE -i ID-FILE
11 osmium getid [OPTIONS] OSM-FILE -I ID-OSM-FILE
12
14 Get objects with the given IDs from the input and write them to the
15 output.
16
17 IDs can be given on the command line (first case in synopsis), or read
18 from text files with one ID per line (second case in synopsis), or read
19 from OSM files (third cases in synopsis). A mixture of these cases is
20 also allowed.
21
22 All objects with these IDs will be read from OSM-FILE and written to
23 the output. If the option -r, –add-referenced is used all objects ref‐
24 erenced from those objects will also be added to the output.
25
26 Objects will be written out in the order they are found in the
27 OSM-FILE.
28
29 If the option -r, –add-referenced is not used, the input file is read
30 only once, if it is used, the input file will possibly be read up to
31 three times.
32
33 On the command line or in the ID file, the IDs have the form: TYPE-LET‐
34 TER NUMBER. The type letter is `n' for nodes, `w' for ways, and `r'
35 for relations. If there is no type letter, `n' for nodes is assumed
36 (or whatever the –default-type option says). So “n13 w22 17 r21” will
37 match the nodes 13 and 17, the way 22 and the relation 21.
38
39 The order in which the IDs appear does not matter. Identical IDs can
40 appear multiple times on the command line or in the ID file(s).
41
42 On the command line, the list of IDs can be in separate arguments or in
43 a single argument separated by spaces, tabs, commas (,), semicolons
44 (;), forward slashes (/) or pipe characters (|).
45
46 In an ID file (option -i/–id-file) each line must start with an ID in
47 the format described above. Leading space characters in the line are
48 ignored. Lines can optionally contain a space character or a hash sign
49 (`#') after the ID. Any characters after that are ignored. (This also
50 allows files in OPL format to be read.) Empty lines are ignored.
51
52 Note that all objects will be taken from the OSM-FILE, the ID-OSM-FILE
53 is only used to detect which objects to get. This might matter if
54 there are different object versions in the different files.
55
56 The OSM-FILE can not be a history file unless the -H, –with-history
57 option is used. Then all versions of the objects will be copied to the
58 output.
59
60 If referenced objects are missing from the input file, the type and IDs
61 of those objects is written out to STDERR at the end of the program
62 unless the -H, –with-history option was given.
63
64 This command will not work with negative IDs.
65
67 –default-type=TYPE
68 Use TYPE (`node', `way', or `relation') for IDs without a type
69 prefix (default: `node'). It is also allowed to just use the
70 first character of the type here.
71
72 –history
73 Deprecated. Use –with-history instead.
74
75 -H, –with-history
76 Make this program work on history files. This is only needed
77 when using the -r option.
78
79 -i, –id-file[=FILE]
80 Read IDs from text file instead of from the command line. Use
81 the special name “-” to read from STDIN. Each line of the file
82 must start with an ID in the format described above. Lines can
83 optionally contain a space character or a hash sign (`#') after
84 the ID. This character and all following characters are
85 ignored. (This allows files in OPL format to be read.) Empty
86 lines are also ignored. This option can be used multiple times.
87
88 -I, –id-osm-file=OSMFILE
89 Like -i but get the IDs from an OSM file. This option can be
90 used multiple times.
91
92 -r, –add-referenced
93 Recursively find all objects referenced by the objects of the
94 given IDs and include them in the output. This only works cor‐
95 rectly on non-history files unless the -H option is also used.
96
97 –verbose-ids
98 Also print all requested and missing IDs. This is usually dis‐
99 abled, because the lists can get quite long. (This option
100 implies --verbose.)
101
103 -h, –help
104 Show usage help.
105
106 -v, –verbose
107 Set verbose mode. The program will output information about
108 what it is doing to STDERR.
109
110 –progress
111 Show progress bar. Usually a progress bar is only displayed if
112 STDOUT and STDERR are detected to be TTY. With this option a
113 progress bar is always shown. Note that a progress bar will
114 never be shown when reading from STDIN or a pipe.
115
116 –no-progress
117 Do not show progress bar. Usually a progress bar is displayed
118 if STDOUT and STDERR are detected to be a TTY. With this option
119 the progress bar is suppressed. Note that a progress bar will
120 never be shown when reading from STDIN or a pipe.
121
123 -F, –input-format=FORMAT
124 The format of the input file(s). Can be used to set the input
125 format if it can't be autodetected from the file name(s). This
126 will set the format for all input files, there is no way to set
127 the format for some input files only. See osmium-file-for‐
128 mats(5) or the libosmium manual for details.
129
131 -f, –output-format=FORMAT
132 The format of the output file. Can be used to set the output
133 file format if it can't be autodetected from the output file
134 name. See osmium-file-formats(5) or the libosmium manual for
135 details.
136
137 –fsync Call fsync after writing the output file to force flushing buf‐
138 fers to disk.
139
140 –generator=NAME
141 The name and version of the program generating the output file.
142 It will be added to the header of the output file. Default is
143 “osmium/” and the version of osmium.
144
145 -o, –output=FILE
146 Name of the output file. Default is `-' (STDOUT).
147
148 -O, –overwrite
149 Allow an existing output file to be overwritten. Normally
150 osmium will refuse to write over an existing file.
151
152 –output-header=OPTION
153 Add output header option. This option can be given several
154 times. See the libosmium manual for a list of allowed header
155 options.
156
158 osmium getid exits with exit code
159
160 0 if all IDs were found
161
162 1 if there was an error processing the data or not all IDs were
163 found, (this is only detected if the -H, –with-history option
164 was not used),
165
166 2 if there was a problem with the command line arguments.
167
169 osmium getid does all its work on the fly and only keeps a table of all
170 IDs it needs in main memory.
171
173 Output nodes 17 and 1234, way 42, and relation 111 to STDOUT in OPL
174 format:
175
176 osmium getid -f opl planet.osm.pbf n1234 w42 n17 r111
177
179 · osmium(1), osmium-getparents(1), osmium-file-formats(5)
180
181 · Osmium website (https://osmcode.org/osmium-tool/)
182
184 Copyright (C) 2013-2018 Jochen Topf <jochen@topf.org>.
185
186 License GPLv3+: GNU GPL version 3 or later
187 <https://gnu.org/licenses/gpl.html>. This is free software: you are
188 free to change and redistribute it. There is NO WARRANTY, to the
189 extent permitted by law.
190
192 If you have any questions or want to report a bug, please go to
193 https://osmcode.org/contact.html
194
196 Jochen Topf <jochen@topf.org>.
197
198
199
200 1.9.1 OSMIUM-GETID(1)