The OSM revert scripts allow a power user (someone who knows what they are doing with these scripts) to perform change rollback. Unlike Bulk_upload.pl, the scripts don't use OSM Perl packages but rather regular expressions to do all parsing. These scripts, which were written by User:Frederik Ramm in Perl can be downloaded from github.
These scripts should only be used if you are confident that the change sets in question are damaging to OpenStreetMap. Prior to using this script do refer to the Automated edits and to the Automated Edits code of conduct. Make reasonably efforts to discuss the issue with the contributor beforehand and afterwards. Do remain civil and assume good faith. When in doubt, discuss things [lists.openstreetmap.org on an mailing list] before you act.
These scripts do not have safety nets. Be sure that you feel confident to fix anything you might break. If you do not know your PUTs from your GETs, if you do not know the details of API 0.6, or know what changesets are and how they work, then DO NOT USE THIS SOFTWARE.
- changeset.pl / Changeset.pm -- opens and closes changesets
- undo.pl / Undo.pm -- undoes one change to one object
- undelete.pl / Undelete.pm -- undeletes an object; see comment in-file for differences to undo
- revert.pl / Revert.pm -- reverts a whole changeset
Most functionality is implemented as individual Perl modules (.pm). They do not have a namespace because we want people to be able to run everything from the current directory. If you create a Perl module named "Osm::Api", then it has to reside in a subdirectory named "Osm" which tends to get confusing, at least for me.
We're not using any libraries for XML reading and writing, just plain regular expressions.
We're not creating any OO interfaces.
In addition to the modules, there are simple perl scripts (.pl) that can be called from the command line and that provide a command line interface to what the modules do.
If you want to create some hyper cool object oriented undo/redo manager using all the latest libraries and technologies and design patterns, feel free to cannibalize the hell out of this code and make your own.
You will have to create a file in your home directory called .osmtoolsrc containing your user name, password, and the URL of the OSM dev server to use. (Check if you have an account on the dev server.) The URL must be complete up to the API version number and the slash afterwards, so:
username=fred password=test apiurl=http://api06.dev.openstreetmap.org/api/0.6/
By default, all tools will run in "dry run" mode, so no changes will be actually written and all write requests will be considered successful. Add the dryrun=0 parameter to the file for live action.
By default, "dry run" also enables "debug" so you are shown the requests made. If you want to keep debug mode when setting dryrun=0, explicitly set debug=1.
Please use some of the testing servers for the apiurl until you are quite confident working with those scripts. Note that you need to register separate account on each testing server.
Once you are confident you know what you're doing and that the scripts are performing as you want them to, you can change to production API URL (as found for example in JOSM preference "Base server URL" - add /0.6/ to the end of it, to specify API version to use)
The above text was sourced from the README file for the software. The scripts in this directory together form the "osmtools" suite. Originally written by User:Frederik Ramm, public domain. The scripts require Perl and the LWP module (libwww-perl on Ubuntu et al.).