OSMIUM-MERGE(1)

πŸ’– osmium-merge(1) πŸ’–

okay bestie, welcome to the osmium-merge manual page, section 1 of the manual. this is the one that smashes a bunch of OSM files together into one big slay file. let's get into it 🫢


✨ NAME ✨

osmium-merge β€” merge several sorted OSM files into one


✨ SYNOPSIS ✨

osmium merge [OPTIONS] OSM-FILE...

✨ DESCRIPTION ✨

so basically? it takes every OSM file you handed it on the command line and merges all their content into one big gorgeous OSM file. no cap.

⚠️ vibe check first: the objects in all the input files have to be sorted by type, ID, and version. the output will also be sorted that same way. and if an object shows up in multiple input files, it only lands in the output once. periodt.

if you only gave it a single input file, its contents just get copied straight to the output. easy.

now β€” if there are different versions of the same object across the input files, all of those versions will appear in the output. so this command works perfectly fine with history files as input, creating a brand-new history file. πŸ’…

BUT. do not use this command to merge non-history files with data from different points in time. it will not work correctly. like, at all. don't do it.

and here's the feral part: if you've got objects with the same type, id, and version but different other data, the result of this command is undefined. this situation can literally never happen in correct OSM files, but sometimes buggy programs generate data like this. osmium makes no promises about what the result will be if the input data isn't correct. πŸ™ˆ

the good news though? this command reads its input file(s) only once and writes its output file in one go, so it can be streamed β€” meaning it can read from STDIN and write to STDOUT. main character energy fr fr. 🌈


✨ OPTIONS ✨

  • -H, --with-history β€” don't warn when there are multiple versions of the same object in the input files. (she's chill like that)

🌸 COMMON OPTIONS 🌸

  • -h, --help β€” show usage help. your little safety net bestie.
  • -v, --verbose β€” set verbose mode. the program will output information about what it is doing to STDERR. she's narrating her own life ✨
  • --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. same rule, opposite girl πŸ’…

πŸŽ€ 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. (she's all-or-nothing, iconic)

πŸ¦‹ 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. she's making sure it's really on the disk, no ghosting πŸ’Ύ
  • --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. (she's protective of your files, but you can override her)
  • --output-header=OPTION=VALUE β€” 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.

πŸ’€ DIAGNOSTICS πŸ’€

osmium merge exits with exit code

  • 0 β€” if everything went alright, πŸ’–
  • 1 β€” if there was an error processing the data, or
  • 2 β€” if there was a problem with the command line arguments.

🧠 MEMORY USAGE 🧠

osmium merge doesn't keep a lot of data in memory, but if you are merging many files, the buffers might take a noticeable amount of memory. ngl she's pretty light, but the more files you feed her the more buffer she's holding. πŸ“


⭐ EXAMPLES ⭐

merge several extracts into one:

osmium merge washington.pbf oregon.pbf california.pbf -o westcoast.pbf

west coast best coast, ate that 🫢


πŸ‘€ 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, version 1.19.1 of osmium-merge(1) β€” go forth and merge, you've got this πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from