Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've got a control to draw lines:

new OpenLayers.Control.DrawFeature(vecLayer, OpenLayers.Handler.Path, {
            callbacks : {
            //    "done" : doneHandler,
                "point" : function(aPoint){
                    console.log(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
add comment

2 Answers

up vote 3 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
add comment

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_ctrl.events.on({
        "measure" : handleFinalMeasurements,
        "measurepartial" : handleMeasurements
    });

and then getting event.measure

share|improve this answer
add comment

Your Answer

 
discard

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.