OpenStreetMap

aarthy's Diary

Recent diary entries

Shipping JOSM configuration plugin

Posted by aarthy on 18 December 2015 in English.

Shipping JOSM configuration plugin

I’ve updated and shipped the Task configuration plugin, previously written about on this diary post. With JOSM-configuration, you can load imagery, set filters, apply mappaint styles, and set a changeset comment, with one mouse click. This update makes it much easier to access configuration files.

Originally, the JOSM configuration plugin only loaded configuration files from a gist link. Now, the plugin has a default set of configuration files, which are available from a drop down menu.

The plugin keeps the list of default configurations on GitHub. Make a pull request if you come up with another useful configuration. You can also still create your own configurations, and load with Load task from gist. Configuration files use this JSON structure. screen shot 2015-12-18 at 12 35 41 pm

Finally, there is a clear option, which restores JOSM to the state it was before the new configuration was loaded. ​ #### Installing To install this plugin the user can download the jar from here and copying it to JOSM’s plugin folder. On OSX this is ~/Library/JOSM/plugins. Activate the plugin from JOSM Preferences > Plugins and restart JOSM. ​ #### Usage screenshot 2015-12-11 15 00 22 - The ‘Task Config’ menu lists common tasks that you can choose from. This startup list is universal for all users of the plugin. - The configuration for each task includes imagery layers, mappaint styles, filters, changeset comment and source specific for the mapping task. - Use clear to remove any configuration settings that were applied and restore your environment. ​

A task configuration plugin for JOSM

Posted by aarthy on 13 November 2015 in English. Last updated on 16 November 2015.

While working on complex mapping projects like the highway realignment in Japan as part of the Mapbox data team, I realized there was various steps involved in getting JOSM configured for a particular project. This involved setting up a custom map paint style to highlight fresh data, data filters, plugins, scripts, special shortcuts, imagery, changeset and source comment.

The HOT tasking manager currently takes care of the imagery and changeset comments using remote control, but not much else. This was my main motivation to create a remote control plugin to that can help setup JOSM with everything a mapper requires to work a specific project that has special instructions. This allows mappers to directly concentrate on mapping rather than following setup instructions.

By remotely passing a task configuration JSON to JOSM, the plugin should be able to set the right options for the task. In this example, two imagery layers, filters, source and changeset comments, filters and a map paint style are defined.

The first step in creating a JOSM plugin is to register it by following the developer’s guide to creating JOSM plugins. You can change the name, version and other such plugin specific information by editing the build.xml file.

Working

The plugin currently works by passing a Github gist URL to a specific task configuration file. The gist API is then used to load the JSON from the URL and customise JOSM.

josm task

Layers

The imagery layers are added to the main MapView. Previous layers are cleared as well in order to prevent the same layer from being added multiple times.

Source

The source and comment values are added to the current dataset’s changeset once the data layer is loaded.

Map Paint styles

The map paint style is added to the main mapFrame. The list of StyleSources are checked to see if the map paint style is already set. If not then the new map paint style is added to the MapFrame from a URL where the mapCSS is hosted.

Filters

Similar to the changeset source and comment, filters can be added only after the data layer has been loaded. In order to do this, each filter is loaded one by one from the gist and added to the FilterTableModel which adds the filters and executes them on the current dataset when the data layer is loaded.

Next steps

There were a couple of difficulties I faced while writing this plugin for JOSM. For instance, I had to rely heavily on JOSM’s own source code to understand how JOSM APIs work since there are very few guides or tutorials available online. I also looked at how other open source JOSM plugins implemented similar functionality like getting/setting various parameters (layers, changesets, etc).

I do intend on making the plugin more user friendly and easier for large groups of people to collaborate and work on the same area without any hassle. For now we use it to automatically set the configurations before we start mapping a new area. Therefore, on opening JOSM and running the plugin our configurations are set for us.

My next actions include making the link to be provided more liberal by allowing the user to provide the gist link alone and not the gist API URL. Furthermore, it would make it would help to clear all fields once the said task is completed. I do wish to publish the plugin at some point, so if there is any other way this problem could have been tackled, I would love to hear about it!

The code for the plugin can be found here and the README explains how to use it.

Location: Old Thippasandra, Bangalore East, Bengaluru Urban, Karnataka, 560038, India