create an spatiallineobject from 2 points, optional export as shapefile

sp_line(
  Y_coords,
  X_coords,
  ID = "ID",
  proj4 = "+proj=longlat +datum=WGS84 +no_defs",
  export = FALSE,
  runDir
)

Arguments

Y_coords

Y/lat coordinates

X_coords

X/lon coordinates

ID

id of line

proj4

projection

export

write shafefile default = F

runDir

character runtime folder

Examples

if (FALSE) {
## creating sp spatial point object
line <- sp_line(c(8.770367,8.771161,8.771536),
                c(50.815172,50.814743,50.814875),
                runDir=tempdir())

## plot it
plot(line)
}