JOSM/Plugins/Splinex
Splinex JOSM plugin is based on the idea of Spline-drawing-tool, but allows to fully edit a spline like as in vector graphics editors before converting it to a way. You can use it for instance to draw ways in mountain areas or outline shape of rivers. Combined with PlugIn ContourMerge, Splinex can be used to modify existing ways. Keep in mind: For beginners seems the use of Splinex to be difficult and less intuitive. Especially where to put control points might be difficult but after half hour excercises it works very well. Don´t forget to generalize the polyline after being ready with drawing: Use shortcout SHIFT+Y for that for instance with generalization factor 0.25 for ways and e.g. 0.35 for areas.
Usage
- Click+drag on free ares to add new nodes and set control points of Bézier curve.
- Click+drag existing nodes or control points to move them.
- Double click on the resulting spline to finish.
- Double click on the first point of the spline to close it.
- Backspace one step back.
- L is JOSM tastature shortcut.
Ctrl does the following:
- Disables snap to existing nodes
- Disables automatic movement of counterparts when dragging control points
- Sets new control points when dragging a node (useful to convert sharp corners to curves)
- Press the F12 button to open preferences window. Then scroll in this window down to the Splinex button.
You can decide how exactly spline shall be recalculated to the polygon. Default value is 10.
Examples
Green lines are tangents with control points at ends, red line is the resulting spline:
Note: Keeping CTRL button pressed, you can modify the tangents. Point nr. 1 in the example below has different angles and lengths left and right Point nr. 2 two different lengths left and right:
Splines can be useful for drawing tunnels: on the satellite you can see only entrance and exit, GPS doesn't work at tunnels either. One can approximate tunnel path by aligning tangents along entrance and exit roads:
Good practice
Using Splinex the number of points needed for street curve approximation might be reduced by increased quality of way midline approximation. Splinex generates a lot of points so it is important to reduce it in JOSM using Tools -> "Simplify way" (Shortcut: Shift + Y). The value for simplification depends on the case, for instance midline of one river might be maximum error in meters = 0,7 or 0,8m midline of one curvy way in mountains might be 0,25 m.
Try to use al less control points as possible. After changing spline in polygon you might have unnecessary points in the final curve in areas close to the control points.
Example after "plain" rendering (just double click after end of painting):
The same polyline after removing of points with simplify way tool with 25 cm tolerance:
Examples
Only three points with different length and rotation angle of arms at the anchor points
Other examples
Komplex way examples
1. Just complicated way
2. Only few anchor points needed
3. the same area after generalization with factor 25 cm
TODO
- Virtual nodes to add new segments in the middle of the spline
- Angle snapping
- Adaptive subdivision
- Modeful drawing -- implement two different map modes to draw and to edit splines. Currently only modeless Potlach-like drawing is possible.
- Ability to set control points without click+drag
- Status bar hints