JOSM/Plugins/LineSplitter

From OpenStreetMap Wiki
Jump to navigation Jump to search

Description

This plugin implements automatic splitting of long selected ways into multiple segments in JOSM based on a maximum point limit per segment. It safely preserves all tags, handles closed polygons/rings without breaking topology, and automatically updates all parent relations (such as routes and multipolygons) by replacing the original way with the newly created segments in correct sequential order.

Usage

  1. Select one or more ways (by clicking or by selection box)
  2. Choose Mytools → Line Splitter from the menu or press the keyboard shortcut (default: Ctrl+ Shift+Z).
    • Note: If the default shortcut is already in use, JOSM will assign a different one. You can see the current key combination in the Mytools menu next to the plugin name.
  3. Configure the parameters:
    • Maximum points per segment: — the maximum allowed number of nodes in each resulting segment (minimum value: 2, default: 10).
      • Note on the last segment: the final segment contains the remaining points of the way and may have fewer points than the specified limit (minimum 2 points), but will never exceed it.
  4. Click OK
  5. Upon completion, a summary notification will display the number of split ways and the total number of created segments.

Key Features

  • Tag preservation: all newly generated segments inherit the complete set of tags and attributes from the original way.
  • Closed loop support: closed ways (polygons and roundabouts) are split smoothly while maintaining structural continuity across boundary nodes.
  • Relation integrity: parent relations (such as boundary relations, public transport routes, and multipolygons) are automatically updated: the original member way is replaced by the complete sequence of new segments while retaining roles.
  • Batch processing: supports processing multiple selected ways in parallel in the background with a progress indicator and full Undo/Redo integration.

Installation

  1. Download the JAR file from the Releases section on GitHub
  2. Copy it to the JOSM plugins folder:
    • Windows: %APPDATA%\JOSM\plugins\
    • Linux: ~/.local/share/JOSM/plugins/ or ~/.josm/plugins/
    • macOS: ~/Library/JOSM/plugins/
  3. Restart JOSM (the plugin supports loading at runtime as well)

Source code

GitHub repository

License

GNU General Public License v3.0