JOSM/Plugins/Surveyor

From OpenStreetMap Wiki
< JOSM‎ | Plugins
Jump to navigation Jump to search

Surveyor is a plugin for JOSM that allows a mapper to add information to JOSM at the current position. The idea is that a small keyboard is placed near the driver, so it can be reached without looking away from the street. Audio feedback gives enough information, so the driver will not be distracted. Alternatively, a passenger can make the annotations. A default set of annotation buttons is included, or you can define your own.

The current position is retrieved by the LiveGPS plugin (thanks to Frederik Ramm), which in turn retrieves the GPS data from gpsd.

A small toggle dialog shows the current GPS information. An auto-save feature ensures that the OSM data, the GPS data and the markers added are saved every minute into the directory JOSM was started from. The filenames are surveyor-[date]-[time].[osm|gpx]. You should definitely use this feature; while you can do Save As... on the LiveGPS points at a later time, there is currently no other way to permanently save all of the markers added by the Surveyor plug-in.

Surveyor frame.png

The image above shows the surveyor frame (including the current way from the loaded OSM data (showing name (ref) {highway-type} and [tunnel/bridge]). A single button press executes an action. There are also toggle buttons that may indicate an on/off state (like start/end of bridge). In this case, the text of the new marker is automatically extended with a "start" or "end".

Writing a surveyor.xml

The buttons (text, icon and hotkey) and the actions to be executed are configured in an xml file (surveyor.xml). A default file is included, but the josm preference surveyor.source defines its location, so you can use a new one without recompiling.

surveyor.xml follows the syntax shown here:

<?xml version="1.0"?>
<surveyor rows="3" columns="3" width="0" height="0">
  <!-- icons are josm icon names -->
  <!-- action class: either fully qualified classnames or if not found, 
       package at.dallermassl.josm.plugin.surveyor.action is assumed -->

  <!-- set waypoint in marker layer -->
  <button label="Tunnel Start" hotkey="T" icon="tunnel">
    <action class="SetWaypointAction" params="tunnel start"/>
    <!--action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/-->
    <action class="SystemExecuteAction" params="mplayer,-quiet,/usr/share/apps/klettres/de/alpha/t.ogg"/>
  </button>

  <!-- set node in osm layer -->
  <button label="Parking" hotkey="P" icon="parking">
    <action class="SetNodeAction" params="amenity=parking,source=survey"/>
    <action class="PlayAudioAction" params="/usr/share/sounds/KDE_Window_Iconify.wav"/>
  </button>

  <button label="Fuel Station" hotkey="F" icon="fuel">
    <action class="SetNodeAction" params="amenity=fuel"/>
    <action class="AnnotationPresetAction" params="Fuel"/>
  </button>

  <!-- more buttons to be defined -->
</surveyor> 

The available actions are:

  • SetNodeAction: set a node at the current position, set key/value pairs as configured and select the new node.
  • AnnotationPresetAction: open an annotation-preset dialog for the current selection, so use a SetNodeAction before to create a new node! These dialogs needs user input, so do not use them while you are driving!
  • SetWaypointAction: add a marker (in the gps layer) with a configured text. it also opens a little window where the user may add some additional information. This window is closed automatically after 5 seconds of no keyboard input. So the driver does not get distracted by searching the "ok" button. This additional information is added to the configured text of the marker.
  • PlayAudioAction: play a sound file (wav)
  • SystemExecuteAction: execute a system command