JOSM/Plugins/Tracks2Map

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

The JOSM plugin Tracks2Map opens all GPX tracks in the current map view from a specified directory. It can optionally work recursively on subdirectories. Only those tracks, are opened that actually cross the map view. If available, associated markers are opened as well.

As the plugin may open a number of GPX track layers and GPX marker layers at a time, it also provides a menu option for deleting all GPX layers at a time.

Configuration

Preferences dialog

Tracks2Map preferences dialog
  1. From the JOSM menu bar, select Edit -> Preferences.
  2. In the opened preferences dialog, select the tab Tracks2Map.
  3. Select the directory with your recorded or gathered GPX tracks via the file chooser dialog and check the Recursive option as needed.
  4. Click the OK button at the bottom.

Configuration options

Option Default Description
GPX Track Directory null Path of the directory where the recorded or gathered GPX tracks are located.
Recursive true If enabled, the plugin will work on subdirectories recursively.

Usage

File menu actions

Tracks2Map file menu actions

Tracks2Map adds two actions to the JOSM file menu:

  • Open all tracks in map view: Opens all GPX tracks which cross the current map view from the specified directory and optionally its subdirectories.
  • Delete all GPX track and marker layers: Deletes all GPX layers at a time so they do not need to be closed one by one.

Toolbar icons

Adding Tracks2Map menu actions as icons to JOSM toolbar

The two above mentioned menu actions can be added to the toolbar as icons:

  1. From the JOSM menu bar, select Edit -> Preferences.
  2. In the opened preferences dialog, select the tab Toolbar.
  3. In the tree Available on the right, expand the File node and select the Tracks2Map menu actions.
  4. Click on the button with the blue arrow to the left which is located in the middle section.
  5. The actions are now part of the toolbar list.
  6. Use the light blue up and down arrows to adjust the position of the icons in the toolbar as desired.
  7. After clicking OK, the icons will be available in the toolbar.
Customized JOSM toolbar with Tracks2Map actions (left: Open all tracks in map view, right: Delete all GPX tracks and marker layers)

Opening all tracks in the current map view

When executed in a JOSM session for a specified GPX tracks directory for the first time, the action may take some time to finish (depending on the number of GPX files) as all GPX files in the directory (tree) have to be opened and the track bounds have to be determined. The next time that the action is executed, it will run much faster as the track bounds are kept in memory and therefore only new GPX files or GPX files with track bounds intersecting the map bounds will be opened to check if the track actually crosses the map view.

To provide the user a feeling of the time required to finish, a progress dialog is shown each time that the tracks open action is executed.

Source code

The source code can be obtained from JOSM Tracks2Map Plugin on GitHub.