as.lines {terra} | R Documentation |
Conversion to a SpatVector of lines
Description
Conversion of a SpatRaster, SpatVector or SpatExtent to a SpatVector of lines.
Usage
## S4 method for signature 'SpatRaster'
as.lines(x)
## S4 method for signature 'SpatVector'
as.lines(x)
## S4 method for signature 'SpatExtent'
as.lines(x, crs="")
Arguments
x |
SpatRaster, SpatVector or SpatExtent |
crs |
character. The coordinate reference system (see |
Value
SpatVector
See Also
Examples
r <- rast(ncols=2, nrows=2)
values(r) <- 1:ncell(r)
as.lines(r)
as.lines(ext(r), crs=crs(r))
if (gdal() >= "3.0.0") {
p <- as.polygons(r)
as.lines(p)
}
[Package terra version 1.7-78 Index]