osmium-derive-changes man page

osmium-derive-changes — create OSM change files from two OSM data files


osmium derive-changes [Options] OSM-FILE1 OSM-FILE2


Finds differences between two OSM files and creates a change file with those differences. The resulting change file is created in a way, that it could be applied on OSM-FILE1 to re-create OSM-FILE2.

Objects in both input files must be sorted by type, ID, and version. The first input file must be from a point in time before the second input file.

For this command to create a proper chnage file you have to set the --output option or --output-format option in a way that it will generate an .osc file, typically by using something like '-o out.osc.gz'. You can create any other OSM file format, but that is usually not what you want. Osmium derive-changes will warn you in this case.

Note that for objects that are in OSM-FILE1 but not OSM-FILE2 a "deleted" entry will be created in the output. But because we can not know when this deletion actually occurred, in which changeset, and by which user, it is unclear what attributes this deleted object should have. Also, if you are working with extracts, the object might not actually have been deleted in the OSM database, but just moved out of the extract you are looking at. So a real, new, "deleted" version was never created. Usually the "deleted" object will get the same version number and timestamp as the object in OSM-FILE1 had, all other information will be removed. But you can change this using the --increment-version, --keep-details, and --update-timestamp options. Depending on which software you are using the change files with, different settings might be necessary.


Increment version number of deleted objects.
Keep details of deleted objects. Usually only id, version, and timestamp are kept. If this option is set all attributes, all tags, and all nodes or members for ways and relations, respectively, are kept.
Update timestamp of deleted objects to the current time. This is the same behaviour as Osmosis.

Common Options

-h, --help
Show usage help.
-v, --verbose
Set verbose mode. The program will output information about what it is doing to stderr.

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.
Call fsync after writing the output file to force flushing buffers to disk.
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.
Add output header option. This option can be given several times. See the libosmium manual for a list of allowed header options.


osmium derive-changes exits with exit code

if everything went alright,
if there was an error processing the data, or
if there was a problem with the command line arguments.

Memory Usage

osmium derive-changes doesn't keep a lot of data in memory.


Find changes in Nepal extract in January 2016:

osmium derive-changes nepal-20160101.osm.pbf nepal-20160201.osm.pbf -o nepal-jan.osc.bz2

See Also

osmium(1), osmium-file-formats(5), osmium-apply-changes(1), osmium-diff(1)
Osmium website (http://osmcode.org/osmium)


If you have any questions or want to report a bug, please go to http://osmcode.org/contact.html


Jochen Topf <jochen@topf.org>.

Referenced By

osmium(1), osmium-apply-changes(1), osmium-diff(1).

Explore man page connections for osmium-derive-changes(1).