My array is dynamic and the length varies, but it looks like this:
var coord_list = [[-7.84 , 12.32],[-8.30 , 10.42],[-11.84 , 12.32]....]
I am trying to incorporate each element (coordinates) "[-7.84 , 12.32]"
into a turf module which is done like this:
turf.lineString([[-7.42,9.125],[-8.43,9.800]]...(all of them), {name: 'line 2'});
.
When attempting to use the var coord_list
array directly, I encountered issues despite it having the same structure internally.
turf.lineString([coord_list], {name: 'line 2'}); --> Error: coordinates must be an array of two or more positions
turf.lineString(coord_list, {name: 'line 2'}); --> Error: coordinates must contain numbers
How can I properly integrate each coordinate into the turf formula?