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