Can someone help in finding coordinates of drawn features? I am using this example OpenLayers website. I need to be able to export drawn objects as set of coordinates.
Posting the code from the resource, although it can be found here.
Snap Interaction
Answer
The drawn feature are added to the layer named vector
. See draw interactions constructors.
// Get the array of features
var features = vector.getSource().getFeatures();
// Go through this array and get coordinates of their geometry.
features.forEach(function(feature) {
console.log(feature.getGeometry().getCoordinates());
});
No comments:
Post a Comment