Here are two Python scripts that:
- Revert simple OpenStreetMap changesets. Way and relation structural changes cannot be reverted, all other changes can. For example, if you deleted a lot of objects, or changed many tags at once.
- Restore an old version of a given object. All of its deleted references are restored as well.
If there are no errors, scripts would ask you for OSM login and password (which are immediately forgotten) and upload the changes. Alternatively you can redirect output to a file and open it in e.g. JOSM for reviewing and uploading.
git clone https://github.com/Zverik/simple-revert.git cd simple-revert
Or just press "Download ZIP" button above and unpack the archive.
Specify changeset ids as the
simple-revert script arguments. E.g.
./simple_revert.py 12345 12346 12348
To list recent changesets by a user (e.g. you), specify their name as the only argument:
To restore an old object version, pass its type, id and version to
restore_version. For the first argument you can use following formats:
n12345for a node,
r234234for ways and relations.
"way 2343"(note the quotes).
https://www.openstreetmap.org/node/12345or any other similar link.
https://api.openstreetmap.org/api/0.6/node/12345/6includes a version to restore.
Version number should be either a positive integer, or a negative, relative to the last version. E.g. this command will revert the last change to a node:
./restore_version.py n12345 -1
To get a list of recent versions, run the script without a version argument.
Author and License
Written by Ilya Zverev, licensed WTFPL.