Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to hook up keyboard shortcuts to my map controls e.g. holding down 'z' will activate the zoombox tool etc. I can't seen anything relevent in the API for doing this. Is it easily done? My controls are sat beneath dojo toggle buttons and menu items like so:

// zoom tool
zoomBoxTool = new OpenLayers.Control.ZoomBox();

// zoom button
var zoomBoxButton = new dijit.form.ToggleButton({
    label : "Zoom",
    iconClass: "zoomIcon",
    showLabel : false,
    onChange : function(val) {
        toggleTool(val, zoomBoxTool, this)
share|improve this question

in my application, with using extjs and openlayers, in extjs app. i have control whether capslock open or not with some charcodes...

in openlayers you can add some handleKeyEvent script to openlayers/lib/Handler/Keyboard.js which is locate end of the code.

you can look at for Javascript Char Codes and some Openlayers Code

i hope it helps you

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.