This is a simple wrapper around spLines() that makes the creation of SpatialLines objects easy and intuitive

points2line(p)

Arguments

p

A spatial (points) obect or matrix representing the coordinates of points.

See also

Examples

p <- matrix(1:4, ncol = 2) library(sp) l <- points2line(p) plot(l)
l <- points2line(cents)
#> Warning: CRS object has comment, which is lost in output
#> Warning: Discarded datum Unknown based on WGS84 ellipsoid in Proj4 definition
plot(l)
p <- line2points(routes_fast)
#> Warning: CRS object has comment, which is lost in output
#> Warning: Discarded datum Unknown based on WGS84 ellipsoid in Proj4 definition
l <- points2line(p)
#> Warning: CRS object has comment, which is lost in output
#> Warning: Discarded datum Unknown based on WGS84 ellipsoid in Proj4 definition
plot(l)
l_sf <- points2line(cents_sf) plot(l_sf)