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've got a control to draw lines:

new OpenLayers.Control.DrawFeature(vecLayer, OpenLayers.Handler.Path, {
            callbacks : {
            //    "done" : doneHandler,
                "point" : function(aPoint){

and now i can get all points from linestring i add to the map. But what i need is to get length of the feature that is not finished (the reason i can't use done callback).

How can i make this? I'm completly stuck, any help!

share|improve this question
up vote 4 down vote accepted

you can achive this with immediate measures and OpenLayers Measure Example will help you about your que. Dont forget to check measure distance and use immediate measures...

i hope it helps you

share|improve this answer
thanks, used it. – k102 Mar 26 '12 at 10:17

Thanks to Aragon, i've made it this way:

        var measure_ctrl = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, {
        persist : true,
        immediate : true,
        handlerOptions : {
            layer : vecLayer
        "measure" : handleFinalMeasurements,
        "measurepartial" : handleMeasurements

and then getting event.measure

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.