Utilizing turf.js to generate a line depicting the path of an individual while their location is tracked.
An array of coordinate arrays resembling Turf.js (lineString) is causing this error:
Uncaught Error: coordinates must be an array of two or more positions
Incorporating Vuejs -
export default {
data() {
return {
lat: '',
lng: '',
locationData: [],
}
}
}
Method for creating the line -
targetTrackingLine() {
setTimeout(() => {
if(this.center !== this.defaultCoordinates) {
this.locationData.push([this.lng, this.lat])
turf.lineString([this.locationData], {name: 'line 1'});
}
}, 1500)}
Output when checking my locationData in console
Is it linked to this observer?