I am using leafletFreeDraw and I also tried to follow this SO question
With the following I get the long/lat:
freeDraw.on('markers', function (event) {
// Listen for any markers added, removed or edited,
// and then output the lat lng boundaries.
console.log('LatLngs:', event.latLngs, 'Polygons:', freeDraw.size());
});
And the console output i get is like:
Array[1]
0
:
Array[20]
0
:
L.LatLng
lat
:
51.51435127755928
lng
:
-0.08651733398437501
__proto__
:
Object
1
:
L.LatLng
lat
:
51.51349664501128
lng
:
-0.08505821228027345
__proto__
:
Object
2
:
L.LatLng
Is there a way that I can append each coordinates and have an output in console like the following?
var states = [{
"type": "LineString",
"coordinates": [[-100, 40], [-105, 45], [-110, 55]]
}, {
"type": "LineString",
"coordinates": [[-105, 40], [-110, 45], [-115, 55]]
}];
I'd be fine even to just have printed in console the first set of coordinates witht he correct formatting, then I will manually copy/paste to my geojson file.
"coordinates": [[-105, 40], [-110, 45], [-115, 55]]