I am working on drawing points/segments/polygons on a map that uses OpenLayers 3. The first part I have done draws points, lines and polygons. Now I am trying to retrieve the drawn coordinates in order to build them for other sessions.

I have been able to getting just coordinate for the point/image, but can't get coordinates for segment/polygon. Any ideas or help? I've included a JSfiddle below


1 Answer 1


What you're looking for is the drawend event that is fired by the ol.interaction.Draw object you created. If you hook into it, you will get back the feature that has been drawn. See the fiddle below:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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