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 need to enable feature drawing functionality. Code:

var drawingControl = new OpenLayers.Control.DrawFeature(someLayer, OpenLayers.Handler.Path);

But I also need to do some actions when drawing is done, on double click. Therefore, how can I define a dblclick callback (for example, add there console.log("1"))?

share|improve this question

You can pass a callback function to OpenLayers.Control.DrawFeature featureAdded property, which will be automatically called after you finishing drawing the geometry.

I can image some code like this:

var drawingControl = new OpenLayers.Control.DrawFeature(someLayer, OpenLayers.Handler.Path, {featureAdded: onFeatureAdded});

function onFeatureAdded(){
share|improve this answer

Try using this event if you want to do action immediately after feature is added (no need for double click): featureadded Triggered when a feature is added

Something like this:{

If you still need double click examine this:

OpenLayers - is it possible for a feature to have both a single click and double click event?

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.