wiki:Help/Plugin/Scripting

Version 12 (modified by skyper, 11 years ago) ( diff )

fixed links

Plugin -> Scripting

  1. In a nutshell
  2. Example scripts in Python

In a nutshell

The scripting plugins allows you to run scripts within JOSM.

Use it to automate small tasks for which no dedicated plugin is available, i.e.

  • additional quality tests for which no validator test cases are available
  • automatically entering data in very specific situations (i.e. sequences of house numbers)
  • importing from a custom file format not supported by JOSM
  • exporting to a custom file format not supported by JOSM

The plugin includes a embedded scripting engine for Javascript based on Mozilla Rhino and a Javascript API for the JOSM application objects.
Alternatively, you can use any scripting language which provides a JSR-223 compatible scripting engine, in particular Groovy, Python, or Ruby.
Please refer to the plugin documentation for more information and find the source on GitHub.

Example scripts in Python

Here are some more examples:

  • Help/Plugin/Scripting/Python/RCN_Route_Validator
    This is not a trivial script anymore. It does a lot in a complicated field (networks of cycle node routes with numbered nodes), makes changes to relations, writes to a file that can be pasted to the wiki. Analyzes routes, but also networks of routes or collections of networks of routes, depending on the selection in JOSM when the script was run.
  • AutoAddIntersections (needs UtilsPlugin2)
    Adds command queue listener that will perform utilsplugin2's AddNodesAtIntersections command after encountering Extrude command. (See #7991)
    Run once per JOSM session.

Back to Plugin Help
Back to Main Help

Note: See TracWiki for help on using the wiki.