JOSM/Advanced Tricks

From OpenStreetMap Wiki
Jump to: navigation, search

Or cool things about JOSM you didn't know existed.

  1. Got multiple objects on top of each other and can't see them properly? The middle-click mouse button displays a dialog with all the objects under the mouse (On Apple/Mac OS X, this ability varies with the mouse type. This does not appear to be possible with a one-button mouse. With the Mighty Mouse, the scroll ball can be configured as "Button 3" to make this work.)
  2. In addition to the prior trick, if you hold down the Control key (after you did the middle-click), it keeps the window, allowing you to select objects from the list. You may have to hold down the Alt key in addition to the Control key when selecting.
  3. If you hold down the ALT key while deleting a way, JOSM will keep the nodes of the way
  4. Use the command stack window to keep an eye on what's happening. It's very handy to noticing you've accidentally moved a way you didn't intend.
  5. You can look for mistyped tags by selecting everything (Ctrl-A) and then looking at the tag list. If you select a row and hit edit, the dropdown contains all the variations used. Don't actually hit OK here, that would change everything. Instead, use the Search tool to find the bad tags.
  6. JOSM's search function is very extensive. You can match on key:foo and value:bar. There are the keywords "selected" for currently selected objects, "modified" for things changed in this session and "incomplete". You can invert conditions by prefixing a minus and use the pipe symbol as an OR. For details see JOSM/Search function. Closely related: the filter function too hide some data.
  7. See what streets haven't been labeled - search for 'highway=* -name=*', and see what gets highlighted
  8. You've got an error message or a problem with a way/node and you only know an ID? Search for "id:<number>".
  9. Some window managers in linux (kde, enlightenment) catch the alt-mousebutton combination. This can be very disturbing if you want to create a new way that is attached to another one. This can be worked around by first clicking the mousebutton, then hitting alt, then releasing the mousebutton and then release alt. Sometimes you can also press another, unused, modifier together with alt to keep the window manager from grabbing it.
  10. If the default node-movement delay settings get annoying, they can be overridden with the advanced settings edit.initial-move-delay (in milliseconds, defaults to 200) and edit.initial-move-threshold (in pixels, defaults to 15). Both these can be entered using the "Einstein Tab" of the JOSM preferences panel.
  11. Got an .osm file from which you want to remove stuff? JOSM will normally not remove things but mark them with "action=delete" in the saved file. However, if you first change the file to use only negative IDs (sed -e 's/id="/id="-/' or similar), then JOSM will actually delete the items you delete, and write a reduced file when you save it. Alternatively, use XMLStarlet.
  12. Looking for the "invert selection" button? Use the "search" function and search for the expression "-selected".
  13. Save current session (if it takes 5 minutes to open all layers): in JOSM advanced preferences (expert mode), modify the "session" attribute into "true" (without the quotes), then restart.
  14. Create a URL of the current location that you're editing in JOSM by right-clicking on the longitude/latitude (found in bottom, left area of JOSM).
  15. Did you accidentally move a way and then realized you forgot where it originally went, and don't want to upload that change to the server? You can remove it from your local layer but NOT delete it from the server. To do this, select the way that you'd like to forget about, and press Ctrl+Shift+P. In JOSM, this is called purging.
  16. Did you want to change a bit of the appearance of the editor map? For example to highlight untagged nodes in highways which are no connections between different ways? Create a bit of your custom MapCSS style and insert into JOSM. Solution to the mentioned example. More on styles.

Irregular Bookmarks

JOSM has built-in support for bookmarks covering a rectangular area. But what if you want to "bookmark" a complex shape?

  1. Manually download the data you want in multiple steps.
  2. Save to .osm file.
  3. Open .osm file in text editor, remove all nodes, ways, and relations, so that the remaining structure consists of one <osm> element and a number of <bounds> elements only.
  4. Keep this modified file in a safe location. Every time you want to download the area, open the file and select "update" from the File menu.

Fancy geometry tricks

Start off by setting up a sensible projection under Preferences → Map Settings, such as Mercator.

  1. Rotate objects: select everything you want to rotate, hold Shift+Ctrl and click-drag to rotate.
  2. Want to fix up a wobbly building up so all the angles are 90°? Highlight it and press "Q", the shortcut for the Orthogonalize built-in.
    • Be sure you're using a projection like Mercator. If you use something like WGS84, then objects will be distorted when rendered.
    • Doesn't matter what shape it is - could be "F"-shaped or a square - but it must be a closed way and have only two nodes per side (the angles must all be close to 90°, not 180°).
    • You can do this with respect to a line. First highlight the building(s), then add exactly two other nodes to the selection to define the line against which everything must be aligned. Then hit "Q", and presto!
  3. Want to disentangle two or more ways that share the same node? Highlight the node and press "G", the shortcut for the unGroup built-in.
    • You'll get lots of copies of the original node all in the same place. Be sure to merge any unwanted ones back together.
    • If you also select one of the ways which share the node(s) before unGrouping, then after the unGroup the selection will be replaced with one containing just the copies which ended up in the way you selected.

Handy search strings

  1. If you just drew a bunch of ways and want to quickly select a portion of them so you can tag them i.e. highway=path in one go, then search for untagged type:way inview.
  2. To select ways you modified based on a different source than the original use this: source (modified | new | user:myself)
  3. If you modified a piece of coastline and want to remove all the original source and created_by tags on those nodes you moved, select that piece of coastline and do pgs modified child selected allindownloadedarea