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 --add-referenced/-r 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 --add-referenced/-r 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 --id-file/-i) 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 --with-history/-H
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 --with-history/-H 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/-H 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 --id-file/-i but get the IDs from an OSM file. This option
90 can be 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 -t, --remove-tags
98 Remove tags from objects that are not explicitly requested but
99 are only included to complete references (nodes in ways and mem‐
100 bers of relations). If an object is both requested and used as
101 a reference it will keep its tags. You also need --add-refer‐
102 enced/-r for this to make sense.
103
104 --verbose-ids
105 Also print all requested and missing IDs. This is usually dis‐
106 abled, because the lists can get quite long. (This option
107 implies --verbose.)
108
110 -h, --help
111 Show usage help.
112
113 -v, --verbose
114 Set verbose mode. The program will output information about
115 what it is doing to STDERR.
116
117 --progress
118 Show progress bar. Usually a progress bar is only displayed if
119 STDOUT and STDERR are detected to be TTY. With this option a
120 progress bar is always shown. Note that a progress bar will
121 never be shown when reading from STDIN or a pipe.
122
123 --no-progress
124 Do not show progress bar. Usually a progress bar is displayed
125 if STDOUT and STDERR are detected to be a TTY. With this option
126 the progress bar is suppressed. Note that a progress bar will
127 never be shown when reading from STDIN or a pipe.
128
130 -F, --input-format=FORMAT
131 The format of the input file(s). Can be used to set the input
132 format if it can’t be autodetected from the file name(s). This
133 will set the format for all input files, there is no way to set
134 the format for some input files only. See osmium-file-for‐
135 mats(5) or the libosmium manual for details.
136
138 -f, --output-format=FORMAT
139 The format of the output file. Can be used to set the output
140 file format if it can’t be autodetected from the output file
141 name. See osmium-file-formats(5) or the libosmium manual for
142 details.
143
144 --fsync
145 Call fsync after writing the output file to force flushing buf‐
146 fers to disk.
147
148 --generator=NAME
149 The name and version of the program generating the output file.
150 It will be added to the header of the output file. Default is
151 “osmium/” and the version of osmium.
152
153 -o, --output=FILE
154 Name of the output file. Default is `-' (STDOUT).
155
156 -O, --overwrite
157 Allow an existing output file to be overwritten. Normally
158 osmium will refuse to write over an existing file.
159
160 --output-header=OPTION=VALUE
161 Add output header option. This command line option can be used
162 multiple times for different OPTIONs. See the libosmium manual
163 for a list of available header options. For some commands you
164 can use the special format “OPTION!” (ie. an exclamation mark
165 after the OPTION and no value set) to set the value to the same
166 as in the input file.
167
169 osmium getid exits with exit code
170
171 0 if all IDs were found
172
173 1 if there was an error processing the data or not all IDs were
174 found, (this is only detected if the --with-history/-H option
175 was not used),
176
177 2 if there was a problem with the command line arguments.
178
180 osmium getid does all its work on the fly and only keeps a table of all
181 IDs it needs in main memory.
182
184 Output nodes 17 and 1234, way 42, and relation 111 to STDOUT in OPL
185 format:
186
187 osmium getid -f opl planet.osm.pbf n1234 w42 n17 r111
188
190 · osmium(1), osmium-getparents(1), osmium-file-formats(5)
191
192 · Osmium website (https://osmcode.org/osmium-tool/)
193
195 Copyright (C) 2013-2019 Jochen Topf <jochen@topf.org>.
196
197 License GPLv3+: GNU GPL version 3 or later
198 <https://gnu.org/licenses/gpl.html>. This is free software: you are
199 free to change and redistribute it. There is NO WARRANTY, to the
200 extent permitted by law.
201
203 If you have any questions or want to report a bug, please go to
204 https://osmcode.org/contact.html
205
207 Jochen Topf <jochen@topf.org>.
208
209
210
211 1.11.1 OSMIUM-GETID(1)