OSMIUM-ADD-LOCATIONS-TO-WAYS(1)
π osmium-add-locations-to-ways π
okay bestie, welcome to the osmium-add-locations-to-ways page, part of the osmium manual situation β¨ this one is literally the "give the ways their locations" command, and it's kind of iconic.
πΈ NAME πΈ
osmium-add-locations-to-ways β add node locations to ways in OSM file πΊοΈ
β¨ SYNOPSIS β¨
osmium add-locations-to-ways [OPTIONS] OSM-FILE...
π DESCRIPTION π
okay so normally only nodes have locations and the ways just point at those locations through the IDs of the nodes. this program copies the input file(s) to the output, grabs the locations from the nodes, and adds them to the ways. it makes life so much easier for other programs trying to assemble the way geometries π«Ά
β οΈ the input file must contain all nodes needed for the ways, otherwise there will be an error. you can change this behaviour using the --ignore-missing-nodes option. no cap.
nodes without any tags will not be copied (unless the --keep-untagged-nodes/-n option is used). the size of the output file will be similar or a bit smaller than the input file (unless the --keep-untagged-nodes/-n option is used, in which case it will be a lot bigger π).
note that the OSM files generated by this command use a format extension. most programs reading OSM files will not understand this extension and should ignore the extra data. it's giving mysterious extra data, and that's on purpose.
the osmium add-locations-to-ways command has to keep an index of the node locations in memory or in a temporary file on disk while doing its work. there are several different ways it can do that which have different advantages and disadvantages. the default is good enough for most cases, but see the osmium-index-types(5) man page for details π
if the --keep-untagged-nodes/-n option is used, files created by this command can be updated with the apply-changes command using the --locations-on-ways option.
this command will not work on full history files. periodt.
the command will work with negative IDs (unless the option --keep-member-nodes is used). the index types for positive IDs and negative IDs are set separately with the --index-type/-i and --index-type-neg options, respectively π§
this commands reads its input file(s) only once (unless the --keep-member-nodes option is used) and writes its output file in one go so it can be streamed, ie. it can read from STDIN and write to STDOUT π the input file must be sorted in the usual order: first nodes, then ways, then relations, objects of each type ordered by id. if there are multiple input files, they will be read in the order specified on the command line. they must together have the correct order, so, for instance, the first one can have all the sorted nodes, the second all the sorted ways, etc. if this is not the case use osmium merge on the inputs first π
π OPTIONS π
-i,--index-type=TYPEβ set the index type for positive IDs. for details see theosmium-index-types(5)man page β¨--index-type-neg=TYPEβ set the index type for negative IDs. for details see theosmium-index-types(5)man page β¨-I,--show-index-typesβ shows a list of available index types. for details see theosmium-index-types(5)man page β¨-n,--keep-untagged-nodesβ keep the untagged nodes in the output file π«Ά--keep-member-nodesβ keep the nodes that are referenced from relations. if this option is specified the input file(s) are read twice. note that the nodes kept when this option is set are a strict subset of the nodes kept when--keep-untagged-nodesis set, so setting both options is unnecessary π--ignore-missing-nodesβ if this is not set a missing node needed for a way results in an error. if this is set, errors are ignored and the way will have an invalid location set for the missing node π
β 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. 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 πΎ--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 π«--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 π
π DIAGNOSTICS π
osmium add-locations-to-ways exits with exit code
0β if everything went alright π1β if there was an error processing the data π2β if there was a problem with the command line arguments π
π§ MEMORY USAGE π§
osmium add-locations-to-ways will usually keep all node locations in memory. for larger data files, this can need several tens of GBytes of memory. see the osmium-index-types(5) man page for details. bestie, please check your RAM before you do this fr fr π
π EXAMPLES π
add node locations to an extract keeping all nodes:
osmium add-locations-to-ways -n -o germany-low.osm.pbf germany.osm.pbf
add node locations to a planet file (without untagged nodes):
osmium add-locations-to-ways -i dense_mmap_array -o planet-low.osm.pbf planet.osm.pbf
π SEE ALSO π
osmium(1),osmium-file-formats(5),osmium-index-types(5),osmium-output-headers(5)- 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 β this was osmium-add-locations-to-ways, version 1.19.1 π β¨ go add some locations to some ways, you're gonna slay π
π¦ 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