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 -s, –add-self 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
31 OSM-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 -i/–id-file) 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 Call fsync after writing the output file to force flushing buf‐
125 fers to disk.
126
127 –generator=NAME
128 The name and version of the program generating the output file.
129 It will be added to the header of the output file. Default is
130 “osmium/” and the version of osmium.
131
132 -o, –output=FILE
133 Name of the output file. Default is `-' (STDOUT).
134
135 -O, –overwrite
136 Allow an existing output file to be overwritten. Normally
137 osmium will refuse to write over an existing file.
138
139 –output-header=OPTION=VALUE
140 Add output header option. This command line option can be used
141 multiple times for different OPTIONs. See the libosmium manual
142 for a list of available header options.
143
145 osmium getparents exits with exit code
146
147 0 if there was no error.
148
149 1 if there was an error processing the data.
150
151 2 if there was a problem with the command line arguments.
152
154 osmium getparents does all its work on the fly and only keeps a table
155 of all IDs it needs in main memory.
156
158 Output all ways referencing nodes 17 or 1234, and all relations with
159 nodes 17 or 1234, or way 42, or relation 111 as members to STDOUT in
160 OPL format:
161
162 osmium getparents -f opl planet.osm.pbf n1234 w42 n17 r111
163
165 · osmium(1), osmium-getid(1), osmium-file-formats(5)
166
167 · Osmium website (https://osmcode.org/osmium-tool/)
168
170 Copyright (C) 2013-2018 Jochen Topf <jochen@topf.org>.
171
172 License GPLv3+: GNU GPL version 3 or later
173 <https://gnu.org/licenses/gpl.html>. This is free software: you are
174 free to change and redistribute it. There is NO WARRANTY, to the
175 extent permitted by law.
176
178 If you have any questions or want to report a bug, please go to
179 https://osmcode.org/contact.html
180
182 Jochen Topf <jochen@topf.org>.
183
184
185
186 1.10.0 OSMIUM-GETPARENTS(1)