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 the osmium-index-types(5) man page ✨
  • --index-type-neg=TYPE β€” set the index type for negative IDs. for details see the osmium-index-types(5) man page ✨
  • -I, --show-index-types β€” shows a list of available index types. for details see the osmium-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-nodes is 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. 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 πŸ’Ύ
  • --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 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 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 πŸ‘€


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