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.
Only object type, id, and version are compared, so this program will not detect differences in, say, the tags, unless the object has a new version, which is the normal way things work in OSM. If you need to compare all data in OSM files, have a look at the osmium diff program.
For this command to create a proper change 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.
This commands reads its input files only once and writes its output file in one go so it can be streamed, ie. it can read from STDIN and write to STDOUT.
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.
- -h, --help
Show usage help.
- -v, --verbose
Set verbose mode. The program will output information about what it is doing to STDERR.
- -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.
- -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.
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
Copyright (C) 2013-2017 Jochen Topf <email@example.com>.
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.
If you have any questions or want to report a bug, please go to http://osmcode.org/contact.html
Jochen Topf <firstname.lastname@example.org>.
osmium(1), osmium-apply-changes(1), osmium-diff(1).