OpenStreetMap

Making JOSM faster with javascript keyboard shortcuts

Posted by bdiscoe on 12 March 2014 in English (English)

User interfaces are very much a matter of taste, so with the caveat that this is all really subjective...

In any graphical program, I find that I am most fast and fluid when I have my left hand on the keyboard (e.g. on ASDF) and my right on a mouse. It's best if all the key combinations I need are easily pressed with my left hand. If i have to move my left hand away, or take my right off the mouse, everything slows down.

So, with JOSM. The first thing I do is open the Preferences, under Keyboard Shortcuts and re-map Delete from the Delete key to 'D'. Now, for shortcuts for all the other common tags (highway=service, building=yes...), it's not simple, but it's possible. JOSM lets you map keys to presets, but those presets still open a dialog (extra steps). To program my own shortcuts, I dug into the scripting plugin (Javascript API). It's very nice, well-supported (thank you "Gubear"!) and I've only begun to explore what it can do.

Here is my script (install_custom_menus.js)

To use it, first enable the Scripting plugin in JOSM's plugin preferences. (You'll need the very latest JOSM, 6891 or later, and up-to-date plugins). Now, from the Scripting menu, open the "console", load the js file, and run it. If it works, you will then see 4 new items on your "Edit" menu.

You can now use Preferences: Keyboard Shortcuts to map keys onto them. I use:

  • T : Clear Tiger
  • Shift+T: Turning Circle / Track
  • Shift+S: Service
  • Shift+B: Building

With only basic familiarity with Javascript, you can easily modify the script to add your own commands, and then maps keys to them. You will need to run the script once, each time you restart JOSM, to add the menu items, but the shortcuts are persistent so you only need to set them once.

A word about responsibility. These are just shortcuts for things that JOSM already does, but although you can now do them faster, you still need to focus on quality and standard OSM practice. For example, for cleaning Tiger (in the USA): before I press 'T' to clear the Tiger "reviewed" tag, I visually confirm that the geometry of the road is correct, that the name is good, that cul-de-sacs have been set appropriately (Shift+T), and its good in every way. Only then should one clear that tag.

Happy editing!

Comment from Theodin on 13 March 2014 at 06:34

Impressive ideas about the scripting! Ill have to try this myself :)

One thing I noticed today is that if you remove all tiger tags, some useful ones get deleted too like this one ( http://www.openstreetmap.org/way/12451393 ). I would put the County route info into the ref tag. What do you think?

Hide this comment

Comment from Theodin on 13 March 2014 at 08:54

I just saw that its still there in the alt_name. Must have missed it before. Sorry.

Hide this comment

Comment from bdiscoe on 13 March 2014 at 17:08

Hi Theodin, Yes, some of the Tiger tags are useful up the point where the road is reviewed. At review/cleanup time, you often have to make sense of a mess of bad geometry, mis-naming, etc. and some of the "tiger:" tags can provide clues on how to make the road correct. Once it's correct, though, there really isn't anything in those tags that's relevant. And, even if someone wanted to scan obscure things like "tiger:tlid", for example a program doing some kind of mass-analysis on the history of the tiger import process, it's still available in the way's history. Nothing is lost in OSM :)

Hide this comment

Leave a comment

Parsed with Markdown

  • Headings

    # Heading
    ## Subheading

  • Unordered list

    * First item
    * Second item

  • Ordered list

    1. First item
    2. Second item

  • Link

    [Text](URL)
  • Image

    ![Alt text](URL)

Login to leave a comment