.TH "OSMIUM-GETID" "1" "1.13.1" "" "" .SH NAME .PP osmium-getid - get objects from OSM file by ID .SH SYNOPSIS .PP \f[B]osmium getid\f[R] [\f[I]OPTIONS\f[R]] \f[I]OSM-FILE\f[R] \f[I]ID\f[R]\&... .PD 0 .P .PD \f[B]osmium getid\f[R] [\f[I]OPTIONS\f[R]] \f[I]OSM-FILE\f[R] -i \f[I]ID-FILE\f[R] .PD 0 .P .PD \f[B]osmium getid\f[R] [\f[I]OPTIONS\f[R]] \f[I]OSM-FILE\f[R] -I \f[I]ID-OSM-FILE\f[R] .SH DESCRIPTION .PP Get objects with the given IDs from the input and write them to the output. .PP IDs can be given on the command line (first case in synopsis), or read from text files with one ID per line (second case in synopsis), or read from OSM files (third cases in synopsis). A mixture of these cases is also allowed. .PP All objects with these IDs will be read from \f[I]OSM-FILE\f[R] and written to the output. If the option \f[B]--add-referenced/-r\f[R] is used all objects referenced from those objects will also be added to the output. .PP Objects will be written out in the order they are found in the \f[I]OSM-FILE\f[R]. .PP If the option \f[B]--add-referenced/-r\f[R] is \f[I]not\f[R] used, the input file is read only once, if it is used, the input file will possibly be read up to three times. .PP On the command line or in the ID file, the IDs have the form: \f[I]TYPE-LETTER\f[R] \f[I]NUMBER\f[R]. The type letter is `n' for nodes, `w' for ways, and `r' for relations. If there is no type letter, `n' for nodes is assumed (or whatever the \f[B]--default-type\f[R] option says). So \[lq]n13 w22 17 r21\[rq] will match the nodes 13 and 17, the way 22 and the relation 21. .PP The order in which the IDs appear does not matter. Identical IDs can appear multiple times on the command line or in the ID file(s). .PP On the command line, the list of IDs can be in separate arguments or in a single argument separated by spaces, tabs, commas (,), semicolons (;), forward slashes (/) or pipe characters (|). .PP In an ID file (option \f[B]--id-file/-i\f[R]) each line must start with an ID in the format described above. Leading space characters in the line are ignored. Lines can optionally contain a space character or a hash sign (`#') after the ID. Any characters after that are ignored. (This also allows files in OPL format to be read.) Empty lines are ignored. .PP Note that all objects will be taken from the \f[I]OSM-FILE\f[R], the \f[I]ID-OSM-FILE\f[R] is only used to detect which objects to get. This might matter if there are different object versions in the different files. .PP The \f[I]OSM-FILE\f[R] can not be a history file unless the \f[B]--with-history/-H\f[R] option is used. Then all versions of the objects will be copied to the output. .PP If referenced objects are missing from the input file, the type and IDs of those objects is written out to STDERR at the end of the program unless the \f[B]--with-history/-H\f[R] option was given. .PP This command will not work with negative IDs. .SH OPTIONS .TP --default-type=TYPE Use TYPE (`node', `way', or `relation') for IDs without a type prefix (default: `node'). It is also allowed to just use the first character of the type here. .TP --history Deprecated. Use \f[B]--with-history/-H\f[R] instead. .TP -H, --with-history Make this program work on history files. This is only needed when using the \f[B]-r\f[R] option. .TP -i, --id-file[=FILE] Read IDs from text file instead of from the command line. Use the special name \[lq]-\[rq] to read from \f[I]STDIN\f[R]. Each line of the file must start with an ID in the format described above. Lines can optionally contain a space character or a hash sign (`#') after the ID. This character and all following characters are ignored. (This allows files in OPL format to be read.) Empty lines are also ignored. This option can be used multiple times. .TP -I, --id-osm-file=OSMFILE Like \f[B]--id-file/-i\f[R] but get the IDs from an OSM file. This option can be used multiple times. .TP -r, --add-referenced Recursively find all objects referenced by the objects of the given IDs and include them in the output. This only works correctly on non-history files unless the \f[C]-H\f[R] option is also used. .TP -t, --remove-tags Remove tags from objects that are not explicitly requested but are only included to complete references (nodes in ways and members of relations). If an object is both requested and used as a reference it will keep its tags. You also need \f[B]--add-referenced/-r\f[R] for this to make sense. .TP --verbose-ids Also print all requested and missing IDs. This is usually disabled, because the lists can get quite long. (This option implies \f[B]--verbose\f[R].) .SH COMMON OPTIONS .TP -h, --help Show usage help. .TP -v, --verbose Set verbose mode. The program will output information about what it is doing to STDERR. .TP --progress Show progress bar. Usually a progress bar is only displayed if STDOUT and STDERR are detected to be TTY. With this option a progress bar is always shown. Note that a progress bar will never be shown when reading from STDIN or a pipe. .TP --no-progress Do not show progress bar. Usually a progress bar is displayed if STDOUT and STDERR are detected to be a TTY. With this option the progress bar is suppressed. Note that a progress bar will never be shown when reading from STDIN or a pipe. .SH INPUT OPTIONS .TP -F, --input-format=FORMAT The format of the input file(s). Can be used to set the input format if it can\[cq]t be autodetected from the file name(s). This will set the format for all input files, there is no way to set the format for some input files only. See \f[B]osmium-file-formats\f[R](5) or the libosmium manual for details. .SH OUTPUT OPTIONS .TP -f, --output-format=FORMAT The format of the output file. Can be used to set the output file format if it can\[cq]t be autodetected from the output file name. See \f[B]osmium-file-formats\f[R](5) or the libosmium manual for details. .TP --fsync Call fsync after writing the output file to force flushing buffers to disk. .TP --generator=NAME The name and version of the program generating the output file. It will be added to the header of the output file. Default is \[lq]\f[I]osmium/\f[R]\[rq] and the version of osmium. .TP -o, --output=FILE Name of the output file. Default is `-' (STDOUT). .TP -O, --overwrite Allow an existing output file to be overwritten. Normally \f[B]osmium\f[R] will refuse to write over an existing file. .TP --output-header=OPTION=VALUE Add output header option. This command line option can be used multiple times for different OPTIONs. See the \f[I]libosmium manual\f[R] for a list of available header options. For some commands you can use the special format \[lq]OPTION!\[rq] (ie. an exclamation mark after the OPTION and no value set) to set the value to the same as in the input file. .SH DIAGNOSTICS .PP \f[B]osmium getid\f[R] exits with exit code .TP 0 if all IDs were found .TP 1 if there was an error processing the data or not all IDs were found, (this is only detected if the \f[B]--with-history/-H\f[R] option was not used), .TP 2 if there was a problem with the command line arguments. .SH MEMORY USAGE .PP \f[B]osmium getid\f[R] does all its work on the fly and only keeps a table of all IDs it needs in main memory. .SH EXAMPLES .PP Output nodes 17 and 1234, way 42, and relation 111 to STDOUT in OPL format: .IP .nf \f[C] osmium getid -f opl planet.osm.pbf n1234 w42 n17 r111 \f[R] .fi .SH SEE ALSO .IP \[bu] 2 \f[B]osmium\f[R](1), \f[B]osmium-getparents\f[R](1), \f[B]osmium-file-formats\f[R](5) .IP \[bu] 2 Osmium website (https://osmcode.org/osmium-tool/) .SH COPYRIGHT .PP Copyright (C) 2013\-2021 Jochen Topf . License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. .SH CONTACT .PP If you have any questions or want to report a bug, please go to https://osmcode.org/contact.html .SH AUTHORS Jochen Topf .