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 toSTDERR. she's narrating her own life β¨--progressβ show progress bar. usually a progress bar is only displayed ifSTDOUTandSTDERRare detected to be TTY. with this option a progress bar is always shown. note that a progress bar will never be shown when reading fromSTDINor a pipe. π--no-progressβ do not show progress bar. usually a progress bar is displayed ifSTDOUTandSTDERRare detected to be a TTY. with this option the progress bar is suppressed. note that a progress bar will never be shown when reading fromSTDINor 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. seeosmium-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. seeosmium-file-formats(5)or the libosmium manual for details.--fsyncβ callfsyncafter 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 isosmium/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 theosmium-output-headers(5)man page for a list of available header options. for some commands you can use the special formatOPTION!(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, or2β 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 π
osmium(1),osmium-file-formats(5),osmium-output-headers(5),osmium-merge-changes(1)- Osmium website
Β©οΈ COPYRIGHT Β©οΈ
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
- fedora 44: osmium-tool 1.19.1-1.fc44 Β· GPL-3.0-only
- nixos 26.05: osmium-tool 1.19.1
- nixpkgs unstable: osmium-tool 1.19.1
- ubuntu stonking: osmium-tool 1.19.1-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms