I am trying to activate draw and place the first point when a action is clicked on a feature. This will then create a single line string to the next point where the marker will move to.

However I am having issues initiating the draw feature start point programatically so that my next click would be the second and final point of the line string.

I have tried implementing using:

 function startmove(coords) {

 interaction = new ol.interaction.Draw({
                        type: 'LineString',
                        createFeature: coords,
                        source: source


Does anyone have any ideas on how to achieve this?


Have a look for ol3 example for creating and editing feature

  • Thanks for your response, however its not clear in that example how to programatically set the first point of a line string. – justnorm Mar 21 '16 at 9:17
  • @justnorm, look at this: answer, but private func startDrawing_ might be not available, and I don't know if I could create MouseEvent('click') with *coords * and fire it – Nurlan Mar 22 '16 at 4:44
  • My friend you are a hero! Ive been working on that for so long and searched so hard. This article helped massively!! Its a shame it has to be hacked in this way and isn't part of OL3 as default. But great find thank you! – justnorm Mar 23 '16 at 0:16

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.