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!


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

| improve this answer | |

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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