DOKK / manpages / debian 12 / osmium-tool / osmium-removeid.1.en
OSMIUM-REMOVEID(1) OSMIUM-REMOVEID(1)

osmium-removeid - remove objects from OSM file by ID

osmium removeid [OPTIONS] OSM-FILE ID...

osmium removeid [OPTIONS] OSM-FILE -i ID-FILE

osmium removeid [OPTIONS] OSM-FILE -I ID-OSM-FILE

Copy input file to output removing objects with the specified IDs.

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.

Objects will be written out in the order they are found in the OSM-FILE. The input file is only read once, reading from STDIN is possible by using the special file name `-'.

On the command line or in the ID file, the IDs have the form: TYPE-LETTER NUMBER. 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 --default-type option says). So “n13 w22 17 r21” will match the nodes 13 and 17, the way 22 and the relation 21.

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).

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 (|).

In an ID file (option --id-file/-i) 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.

Note that all objects will be taken from the OSM-FILE, the ID-OSM-FILE is only used to detect which objects to remove.

The OSM-FILE can be a history file in which case all versions of the objects with the specified IDs will be removed.

This command will not work with negative IDs.

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.
Read IDs from text file instead of from the command line. Use the special name “-” to read from STDIN. 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.
Like --id-file/-i but get the IDs from an OSM file. This option can be used multiple times.

Show usage help.
Set verbose mode. The program will output information about what it is doing to STDERR.
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.
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.

The format of the input file(s). Can be used to set the input format if it can’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 osmium-file-formats(5) or the libosmium manual for details.

The format of the output file. Can be used to set the output file format if it can’t be autodetected from the output file name. See osmium-file-formats(5) or the libosmium manual for details.
Call fsync after writing the output file to force flushing buffers to disk.
The name and version of the program generating the output file. It will be added to the header of the output file. Default is “osmium/” and the version of osmium.
Name of the output file. Default is `-' (STDOUT).
Allow an existing output file to be overwritten. Normally osmium will refuse to write over an existing file.
Add output header option. This command line option can be used multiple times for different OPTIONs. See the osmium-output-headers(5) man page for a list of available header options. For some commands you can use the special format “OPTION!” (ie. an exclamation mark after the OPTION and no value set) to set the value to the same as in the input file.

osmium removeid exits with exit code

0
if nothing went wrong
2
if there was a problem with the command line arguments.

osmium removeid does all its work on the fly and only keeps a table of all IDs it needs in main memory.

Output all nodes except nodes 17 and 1234, all ways except way 42, and all relations except relation 111 to STDOUT in OPL format:

osmium removeid -f opl planet.osm.pbf n1234 w42 n17 r111
    

osmium(1), osmium-getid(1), osmium-file-formats(5), osmium-output-headers(5)
Osmium website (https://osmcode.org/osmium-tool/)

Copyright (C) 2013-2023 Jochen Topf <jochen@topf.org>.

License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

If you have any questions or want to report a bug, please go to https://osmcode.org/contact.html

Jochen Topf <jochen@topf.org>.

1.15.0