wiki:Help/Plugin/KindaHackedInUtils

KindaHackedInUtils Plugin

This plugin contains several useful functions that are kind of hacked into JOSM. So they are in some way unconventional to the typical use of JOSM.

"Hijacked" Functions

This functions use existing modes of JOSM without the need to activate them.

Keyboard shortcut Description Used JOSM function
B When pressing B on the keyboard a new point will be created at the mouse location. This works like activating the draw mode and double clicking at the location the point should be created at.
K When pressing K on the keyboard the way at the mouse location will be split at the mouse location. This works like activating the split mode and clicking at the location the way should be split.

Add direction to objects with mouse pointing

Press H on the keyboard to add the direction value to the selected object.

What it does?

The function will add the key direction with a direction value to the selected object. The direction values is either a number of 0 to 359 degrees or the abbreviation of a degree number if the number matches that number. For some objects forward and backward are also used.

Alternative keys are used in following circumstances:

Alternative key Usage dependent on the selected object
railway:signal:direction tag railway=signal is present
traffic_signals:direction tag highway=traffic_signals is present and selected node is part of a way
traffic_sign:direction key traffic_sign is present, the selected node is part of a way and the usage of this key is enabled in the preferences
light:direction tag highway=street_lamp is present
camera:direction tag man_made=surveillance is present
roof:direction key building or building:part is present or the selected node is part of such an object

The direction depends on the mouse location relative to the selected object, the direction of the way the object is part of and if certain keys are present for the selected object when pressing H on the keyboard. If the key traffic_sign, the key/value highway=traffic_signals or railway=signal are present the direction value is handled like this:

If the mouse point anywhere inside the forward area in this image the the point in the middle which is a traffic sign or traffic signals will get the direction value of forward, if the mouse is in the backward area the direction value will be backward. If the mouse is hovering over the way segment A (in direction of the way) after the point in the middle it always will be forward, if the mouse is on the way segment B before the point in the middle it will always be backward.

The exception from those rules is if the direction value of forward or backward would be or could be ambiguous the degree value will be used instead.

If you want to get the direction value for traffic signs with pointing opposite to the front side of the signs instead of pointing to the direction the traffic sign is affecting you can disable Natural direction for traffic signs in the preferences which will only affect the degree values. If you prefer to switch out the forward and backward areas you can add an advanced preference key kindahackedinutils.oppositeSimpleDirection with the value true to the preferences. This preference will only work if Natural direction for traffic signs is disabled.

For example the sign in the middle is a speed limit sign, with the default settings you have to point to the way segment that is affected by the sign, so the way with the speed limit. If the advanced preference is set and Natural direction for traffic signs is disabled you will have to point to the way in front of the sign, so to the way that hasn't the speed limit.

While H is pressed the current value for direction is displayed in the heading label in the status bar and a visualization of the direction is shown:

The helper line and direction cone can be disabled separately in the preferences. For forward/backward direction helper arrows that show the direction are displayed at the current mouse location. To disable those arrows add an advanced preference key kindahackedinutils.directionArrowForSimpleDirection with the value false to the preferences.

If a simple direction is ambiguous for a selected traffic sign node a popup menu with the possible degree values is shown:

While hovering with the mouse over a menu entry the way segment that is affected by the sign is highlighted.

To force the usage of a degree value instead of forward/backward you can use the keyboard shortcut Alt+Shift+H

For traffic signs that are on a node that is part of a way it's possible to use traffic_sign:direction as the key for simple directions instead of direction with enabling the respective preference.

For adding roof:direction to buildings or direction to solar panels two options exist. First to select the building/solar panel, when pressing H the degree value will be calculated from the centroid/barycenter of the nodes of the selected building/solar panel. So you have to point the mouse to the wanted direction relative to the virtual middle point of the building/solar panel. Second option is to select one node of the building/solar panel, pointing the mouse relative to that point in the direction of the roof/solar panel and then pressing H. The resulting degree value will be added to the building/solar panel and the building/solar panel will be selected. If a point is shared by multiple buildings/solar panels a popup menu for the selection of the building/solar panel is shown:

The arrow shows the direction that will be added to the building/solar panel. When hovering over a menu entry the building/solar panel the direction will be added to is highlighted. After selecting an entry the building/solar panel the direction was added to is selected.

Detach nodes from areas

Select Detach nodes from ways and move them from the More tools menu or press Z on the keyboard.

What it does?

Sometimes areas are attached to a way which is typically wrong since the area doesn't reach up to the way line:

Here the areas are attached to the primary highway and the track and the curve is rather sloppy mapped. First add points to the primary highway to make the curve look better. Then select the primary highway and use the detach function, it will result in this:

The detach function will detach and move all points of areas that are attached to the selected way or if the area itself is selected detach and move all points of the area that are attached to ways. The movement of a point typically goes in the direction of the inside of the area but if the area is not a real area but a way that is part of a relation it might go wrong if the relation members are not present in the current edit layer.

Undo changes only for an object

Select Undo/redo changes on selected object from the More tools menu or press Ctrl+Alt+Shift+Z on the keyboard.

What it does?

Sometime you might want to undo an accidentally change of a single object after you've noticed the accident, so all changes to other objects that were done after the accident would be sustained.

To undo the changes of an object select the object or if it was deleted search for the deleted object for selection or copy the id of the deleted object from a newly downloaded layer.

If no object is selected the plugin will present you with a dialog to enter the id of the object to undo:

If an id is present in the clipboard it will be automatically entered as the wanted id. After pressing OK or if an object was already selected you will get the undo/redo dialog for the object:

Here you can select the change that should be undone/redone. The presented changes are all available undo command in which the object was included. Only when the object was deleted there might be missing some commands but those will be available after undoing the deletion of the object.

NOTE: This function will not check if the changes have already been undone/redone. So you have to know what to do.

Create or change turn restrictions

Select source:trunk/resources/images/presets/vehicle/restriction/turn_restrictions/no_u_turn.svg Create turn restriction or change selected from the More tools menu or press Shift+T on the keyboard.

What it does?

Sometimes turn restrictions were created wrong, like this:

To easily fix it select the existing turn restriction relation, then add the new to way to the selection and open the change turn restriction dialog:

Select the corrected restriction and press OK.

This works the same for new turn restrictions, first select the from way, then add the to way to the selection and open the create turn restriction dialog to select the type of the new turn restriction.

NOTE: This is not a replacement for turn restriction plugin, it just leaves out options to make changing existing turn restrictions faster.

Quickly add objects to existing relation

Select Add selected objects to relation from the More tools menu or press Ctrl+R on the keyboard.

What it does?

The selected objects will be added to the selected relation without showing a dialog. The relation the objects should be added to has to be selected as the first object or if a selected object is only a member of one relation and the first selected object isn't a relation that relation will be used. The roles will be guessed based on the type and keys of the relation and the selected objects. If no relation is selected an no object is a member of a relation the dialog to create a new relation is shown. If the selection consists of 2 or 3 objects that might be part of an enforcement relation the creation of an enforcement relation of the types toll, maxspeed and traffic_signals is offered. If such a relation should be crated the from node has to be selected first, the to node second (if there is a to node) and the device last.

Close selected ways

Select Close selected ways from the More tools menu or press Alt+Ctrl+Shift+C on the keyboard.

What it does?

All selected ways will be closed if they are not closed already.

Create area between 2 selected nodes

Select Create area between 2 selected nodes from the More tools menu or press Alt+Ctrl+Shift+A on the keyboard.

What it does?

🡲 🡲

A new closed way between the 2 selected points will be created and the type of the area can be selected/entered for the new way. The way will be created from the 1st selected node in forward direction of the existing way to the 2nd selected node. This only works if the points are on the same way. To specify the way to use also select the way.

If the Shrinkwrap plugin is installed it will also work for nodes of different line, as long as one the ways are connected to each other. To use it with Shrinkwrap select the nodes and place the mouse inside the area to create and press Alt+Ctrl+Shift+A on the keyboard. A helper line will be drawn to close the area for the Shrinkwrap plugin balloon action to work. After the area has been created the helper line will be deleted automatically.

Wrap way around other way

Select Wrap way around other way from the More tools menu or press Shift+F on the keyboard.

What it does?

🡲 🡲

The 1st selected way will be wrapped around the 2nd selected way in forward direction of the 2nd way.

To use this action 1st selected the node before the node that is shared with the wrap way of the to wrap way then the 2nd node which is the start node for the wrap way and then the 3rd node which is the end node for the wrap way. Then selected the way which should be wrap around the other way and finally selected the wrap way. Then press Shift+F or selected the action from the More tools menu.

For example in the 2nd image the 1st selected node is the node at the bottom, the 2nd node is the 1st node shared with the wrap way and the 3rd node is the last node shared with the wrap way. The way between the 2nd and the 3rd node will be wrapped around the wrap way in forward direction, so in this case to the left. If the node at the top and the 2 shared nodes would have been selected the way between the 2nd and 3rd node would have been wrapped around the wrap way in the other direction, so it would go to the right.

Optimize/split multipolygon

Select source:trunk/resources/images/multipoly_update.svg Optimize/split multipolygon from the More tools menu or press Alt+Shift+X on the keyboard.

What it does?

🡲 🡲

If the multipolygon doesn't contain a single closed outer way but the outer way consists of multiple single ways a single outer way will be created and any unused way will be deleted.

A multipolygon that contains at least 2 distinct closed ways will be separated into the needed number of new areas/multipolygons. A new area is created if that area doesn't contain any inner ways, a new multipolygon if there are inner ways.

If the utils2pluign is installed this action can directly split a closed outer way of a myltipolygon and create the needed new areas/multipolygons by selecting the 2 nodes to split between and press Alt+Shift+X on the keyboard or select the action from the More tools menu.

Quick Relation Selection List

source:trunk/resources/images/data/relation.svg keyboard shortcut: Ctrl+Shift+Alt+R

Usage

Whenever an object is selected in JOSM the list will be filled with all relations the selected object is a member of.

When pointing with the mouse to a relation in the list all members will be highlighted in JOSM.

Mouse action on relation in the list effect of the mouse action
single left click The relation will be selected in JOSM and the list will be filled with all relations the selected relation is a member of.
double left click The relation will be selected in the list.
tripple left click The relation will be selected in the list and the relation editor for that relation is opened.

If selected objects are already members of the selected relation a dialog will be shown to select the objects that should be added to the relation again:

The objects can be selected by single left click or single left click dragging.

If you are sure that you want to add selected objects again and don't want to see the dialog you can use the keyboard shortcut Ctrl+Shift+R to directly add those objects to the selected relation.

NOTE: The Quick Relation Selection List will only be available after a restart of JOSM or by removing all layers.

Handle enabled state of preset actions in toolbar

This function will monitor the selection of objects in JOSM and enabled/disable preset actions in the toolbar dependent on the type of the selected objects.

Last modified 11 hours ago Last modified on 2025-12-28T10:38:22+01:00

Attachments (27)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.