I am trying to create a spatial line for multiple individuals in my dataset to then extract raster values across the line.
I have tried a few things but unfortunately the code I am using is assigning all the line to one individual.
WD is the dataset which has 37 individuals in it. x and y are the coordinates.
line_obj <- sp::Line(cbind(WDm2$x,WDm2$y))
lines_obj <- sp::Lines(list(line_obj),ID=WDm2$DogName)
Error in sp::Lines(list(line_obj), ID = WDm2$DogName) :
Single ID required
firstLine <- sp::SpatialLines(list(lines_obj))
If anyone knows how to do this, I would appreciate the help. thanks!
I would like to be able to extract raster values along the lines.