I'm using mapbox-gl-draw in my application and I need to get and save the coordinates of the drawn items on the map. I've checked and I found turf getCoor method, but I don't know how to access the info because I'm using the default set of tools, which you obtain thru the lines below
var Draw = mapboxgl.Draw();
map.addControl(Draw);
Can someone help me figure this out? I'm sure it's pretty easy, I just can't find as many examples online as I wanted it.
EDIT
Also, while trying to figure this out I got type error from turf, which it means just calling <script src='//api.tiles.mapbox.com/mapbox.js/plugins/turf/v1.3.0/turf.min.js'></script>
in my html file didn't work. Am I including it wrong? with https: before the slashes didn't work either.
Best Answer
You could try using
Draw.getAll()
.It should return a feature collection containing all of the drawn features.
The reference for this is here.