Documentation

Using a Jython engine

The JOSM Scripting Plugin can execute scripts written in Python. It can either execute Python scripts using the JSR-223 compatible script engine provided by Jython or load and execute Python plugins using Jythons embedding API.

Implementing and loading Python plugins
How to implement a Python plugin which is automatically loaded at startup time similar to the traditional JOSM plugins written in Java.

Using the embedded JavaScript engine

The JOSM Scripting Plugin is shipped with an embedded scripting engine based on Mozilla Rhino. It consists of a custom instance of the Rhino engine, not identical with the engine shipped with the Java runtime environment (JRE)).

Please note that the JavaScript API isn't frozen yet. The current API may change in future plugin releases. Please report bugs or feature request.

Scripting environment
Global objects in scripts, loading CommonJS modules
Scripting JOSM classes
How to access JOSM classe and use mixins implemented in JavaScript
Manipulating data
How to create data primitives like nodes, ways, or relations. How to add them to datasets, remove them from datasets, and find them in datasets.
Handling layers
How to create, access, and remove layers.
Downloading and uploading data
How to download and upload data to and from the OSM server.
Extending the JOSM menu and the JOSM toolbar
How to extend the JOSM menu and the JOSM toolbar with actions implemented in JavaScript.

Using a pluggable scripting engine

Adding and removing a pluggable scripting engine
How to add or remove a pluggable scripting engine.
Selecting a pluggable scripting engine
How to select a pluggable scripting engine
Sample scripts
Sample scripts in JavaScript, Python, Groovy, and Ruby are available on GitHub.