Skip to main content

Reverting Scripts

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 given object(s). All of their 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.

Installation

pip install --user simple_revert

Simple Revert

Specify changeset ids as the simple-revert script arguments. E.g.

simple_revert 12345 12346 12348

To list recent changesets by a user (e.g. you), specify their name as the only argument:

simple_revert Zverik

Restore Version

To restore an old object version, pass its type, id and version to restore_version. For the first argument you can use following formats:

  • n12345 for a node, w2342 or r234234 for ways and relations.
  • node/12345, node.12345 or even "way 2343" (note the quotes).
  • https://www.openstreetmap.org/node/12345 or any other similar link.
  • https://api.openstreetmap.org/api/0.6/node/12345/6 includes 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 n12345 -1

To get a list of recent versions, run the script without a version argument.

You can pass several objects to restore them all in one changeset:

restore_version n12345 -1 w1234 -1 w1235 -1

Author and License

Written by Ilya Zverev, licensed under ISC license.

Metadata

Release files for simple-revert 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-revert 1.2.0
File Size Uploaded
simple_revert-1.2.0.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-revert 1.2.0
File Interpreter ABI Platform
simple_revert-1.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 25.6 kB

Release files / simple_revert-1.2.0.tar.gz

Download URL simple_revert-1.2.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6a0ccbce45d91b6af514b18643ff1acb10f5137d890ace602a712c13e53f2747
BLAKE2b-256 checksum
How to use checksums
cd56ec482cd7b1f5afa09957436e88d95ffe2d8c0798729de8e922ac0a1ad07a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.8

Release files / simple_revert-1.2.0-py2.py3-none-any.whl

Download URL simple_revert-1.2.0-py2.py3-none-any.whl
Size 13.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
65779e4018655437169c01715e9d2acd691ee09665ccb8dcdcbf87d049e5264d
BLAKE2b-256 checksum
How to use checksums
8e8ed26e5cb6f16c20a99f794ca9879880b37446fd554b0bf0f22bba231ae9a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.8

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page