OSMIUM-RENUMBER(1)
π OSMIUM-RENUMBER β the manual page, bestie edition π
okay so you found osmium-renumber(1) and you're like "what is this" β don't worry, I got you. buckle up π
β¨ NAME β¨
osmium-renumber β renumber object IDs. that's it, that's the vibe. it takes your big scary IDs and makes them smol and tidy π
πΈ SYNOPSIS πΈ
osmium renumber [OPTIONS] OSM-DATA-FILE
π¦ DESCRIPTION π¦
so here's the thing. the objects in an OSM file β nodes, ways, and relations β often have very large IDs. like, absurdly large. and that makes some kinds of postprocessing genuinely difficult, no cap π
this command will renumber all objects using IDs starting at 1. referential integrity will be kept. all objects which appear in the source file will be in the same order in the output file. IDs of objects which are not in the file but referenced from ways or relations are not guaranteed to be in the correct order. (yes that's a real caveat, note it down bestie π)
this command expects the input file to be ordered in the usual way: first nodes in order of ID, then ways in order of ID, then relations in order of ID. negative IDs are allowed, they must be ordered before the positive IDs. see the osmium-sort(1) man page for details of the ordering.
the input file will be read twice, so it will not work with STDIN. but!! if you are not renumbering relations (ie. if the option--object-type/-tis used with nodes and/or ways but not relations) the input file will only be read once, so in that case it will work with STDIN. slay π«Ά
to renumber the IDs in several files, call osmium renumber for each file and specify the --index-directory/-i option each time. see the INDEX FILES section for more details. π
You must never upload the data generated by this command to OSM! This would really confuse the OSM database because it knows the objects under different IDs. like, genuinely do not do this, it's giving chaos π
β¨ OPTIONS β¨
-i,--index-directory=DIRβ directory where the index files for mapping between old and news IDs are read from and written to, respectively. use this if you want to map IDs in several OSM files. without this option, the indexes are not read from or written to disk. the directory must exist. use'.'for the current directory. the files written will be namednodes.idx,ways.idx, andrelations.idx. see also the INDEX FILES section below π--show-index=TYPEβ print the content of the index for TYPE (node,way, orrelation) on STDOUT. each line contains the old ID, a space character and then the new ID. any other options (except--index-directory/-i) are ignored if this option is used. periodt β¨-s,--start-id=FIRST_IDorFIRST_NODE_ID,FIRST_WAY_ID,FIRST_RELATION_IDβ set the first ID that should be used. if the ID is positive, IDs are counted upwards, if the ID is negative, they are counted downwards. this can be set to either a single ID which is used for all object types or a comma-separated list of three IDs used for the first node, way, and relation, respectively. if this is not set, IDs for all object types start at1. π’-t,--object-type=TYPEβ renumber only objects of given type (node,way, orrelation). by default all objects of all types are renumbered. this option can be given multiple times. π
π COMMON OPTIONS π
-h,--helpβ show usage help. our lord and savior π-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. π
π 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. π₯
π 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 thorough π--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, respect it π)--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 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. π€
π INDEX FILES π
when the --index-directory/-i option is specified, index files named nodes.idx, ways.idx, and relations.idx are read from and written to the given directory together with a file called start_ids that contains the start IDs set with --start-id/-s.
this can be used to force consistent mapping over several invocations of osmium renumber, for instance when you want to remap an OSM data file and a corresponding OSM change file. iconic behavior honestly π
the index files are in binary format, but you can print the indexes in text format using the --show-index option:
osmium renumber -i idxdir --show-index node >nodes-index.txt
osmium renumber -i idxdir --show-index way >ways-index.txt
osmium renumber -i idxdir --show-index relation >relations-index.txt
π DIAGNOSTICS π
osmium renumber 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 renumber needs quite a bit of main memory to keep the mapping between old and new IDs. it is intended for small to medium sized extracts. you will need more than 32 GB RAM to run this on a full planet. yeah. she's hungry. π
memory use is at least 8 bytes per node, way, and relation ID in the input file.
β EXAMPLES β
renumber a PBF file and output to a compressed XML file:
osmium renumber -o ch.osm.bz2 germany.osm.pbf
renumbering the about 3.3 GB Germany PBF file currently (February 2020) takes about three minutes and needs about 7 GB RAM. (lowkey impressive ngl π₯)
renumber a PBF file starting the node IDs at 1 (and counting upwards), the way IDs at 100 and the relation IDs at -200 (and counting downwards.
osmium renumber -o renumbered.osm.pbf -s 1,100,-200 athens.osm.pbf
renumber an OSM file storing the indexes on disk:
osmium renumber -i. -o renumbered.osm data.osm
then rewrite a change file, too:
osmium renumber -i. -o renumbered.osc changes.osc
π SEE ALSO π
osmium(1),osmium-file-formats(5),osmium-output-headers(5),osmium-sort(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 thing bestie!! this is version 1.19.1 of osmium-renumber(1) β go forth and renumber responsibly, and remember: never upload this data to OSM πβ¨π¦
π¦ 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