OSMIUM-REMOVEID(1)

πŸ’– OSMIUM-REMOVEID πŸ’–

okay bestie, welcome to the osmium-removeid manual page (that's section 1 of the osmium manual, iykyk) β€” the little command that ghost-blocks objects out of your OSM file by ID. no cap, it's giving surgical removal energy. ✨


🌸 NAME 🌸

osmium-removeid β€” remove objects from OSM file by ID


πŸŽ€ SYNOPSIS πŸŽ€

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

✨ DESCRIPTION ✨

So basically: it copies your input file to the output, except it removes every object with the IDs you named. bye-bye πŸ‘‹

The IDs can come at you three ways:

  1. straight up on the command line (that's the first case in the synopsis)
  2. read from text files, one ID per line (second case)
  3. read from OSM files (third case)

and lowkey you can mix all three together, it's fine, no one's judging. πŸ’…

Objects get written out in the order they show up in OSM-FILE. The input file is only read once, and reading from STDIN is possible if you use the special file name -.

On the command line or in the ID file, IDs look like this: TYPE-LETTER NUMBER. The type letter is n for nodes, w for ways, and r for relations. If you don't put a type letter, it assumes n for nodes (or whatever the --default-type option says, main character behavior). So β€œn13 w22 17 r21” will match the nodes 13 and 17, the way 22 and the relation 21. 🫢

The order the IDs appear in? Doesn't matter, bestie. Identical IDs can appear multiple times on the command line or in the ID file(s) β€” it just doesn't care.

On the command line, your list of IDs can be in separate arguments or in a single argument separated by spaces, tabs, commas (,), semicolons (;), forward slashes (/) or pipe characters (|). versatile queen πŸ‘‘

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. literally just a lookout, not a source.

The OSM-FILE can be a history file, in which case all versions of the objects with the specified IDs will be removed. gone, all of them, the whole timeline πŸ’€

This command will not work with negative IDs. just so you know.

πŸ’… OPTIONS πŸ’…

  • --default-type=TYPE β€” Use TYPE (node, way, or relation) for IDs without a type prefix (default: node). You're also allowed to just use the first character of the type here, because we're chill like that.
  • -i, --id-file[=FILE] β€” Read IDs from a 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 β€” stack 'em up 🧚
  • -I, --id-osm-file=OSMFILE β€” Like --id-file/-i but get the IDs from an OSM file. This option can be used multiple times too.

🌈 COMMON OPTIONS 🌈

  • -h, --help β€” Show usage help.
  • -v, --verbose β€” Set verbose mode. The program will output information about what it is doing to STDERR.
  • --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.
  • --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.

πŸ¦‹ INPUT OPTIONS πŸ¦‹

  • -F, --input-format=FORMAT β€” 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.

⭐ OUTPUT OPTIONS ⭐

  • -f, --output-format=FORMAT β€” 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.
  • --fsync β€” Call fsync after writing the output file to force flushing buffers to disk. safety first bestie 🫢
  • --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 β€œosmium/” and the version of osmium.
  • -o, --output=FILE β€” Name of the output file. Default is - (STDOUT).
  • -O, --overwrite β€” Allow an existing output file to be overwritten. Normally osmium will refuse to write over an existing file. (it's protective, let it be πŸ™ˆ)
  • --output-header=OPTION=VALUE β€” Add output header option. This command line option can be used multiple times for different *OPTION*s. 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.

😭 DIAGNOSTICS 😭

osmium removeid exits with exit code:

  • 0 β€” if nothing went wrong ✨
  • 2 β€” if there was a problem with the command line arguments.

🧠 MEMORY USAGE 🧠

osmium removeid does all its work on the fly and only keeps a table of all IDs it needs in main memory. efficient icon, honestly πŸ‘‘


πŸ”₯ EXAMPLES πŸ”₯

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

πŸ‘‘ SEE ALSO πŸ‘‘


Copyright (C) 2013-2026 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.


πŸ“ CONTACT πŸ“

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


🌸 AUTHORS 🌸

Jochen Topf <jochen@topf.org>.


and that's the whole page bestie πŸ’– this one's version 1.19.1 of the osmium manual β€” go forth and remove IDs, you absolute legend πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from