Лягатып OpenStreetMap OpenStreetMap

A task configuration plugin for JOSM

Дасланы aarthy 13 Лістапад 2015 на English. Апошняе абнаўленьне 16 Лістапад 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.

Месцазнаходжаньне: HAL 3rd Stage, Indiranagar, Bangalore East, Bengaluru Urban, Karnataka, 560075, India
Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Абмеркаванне

Камэнтар PlaneMad ад 13 Лістапад 2015 у 07:25

Nice work Aarthy, a plugin like this will be extremely useful to avoid mistakes due to human error in customizing the various setting in JOSM especially during HOT activations.

Where can I download the plugin/code? Would love to try it out.

Камэнтар aarthy ад 13 Лістапад 2015 у 09:51

Thank you PlaneMad for your comment, I really appreciate it. I haven’t published the plugin as of now, however, the code can be found here. and the README explains how you can use it. Do try it out and let me know how I can make it more efficient.

Увайдзіце каб пакінуць камэнтар