as.lines | R Documentation |
Conversion of a SpatRaster, SpatVector or SpatExtent to a SpatVector of lines.
## 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="")
## S4 method for signature 'matrix'
as.lines(x, crs="")
x |
SpatRaster, SpatVector, SpatExtent or matrix. If |
crs |
character. The coordinate reference system (see |
SpatVector
as.points
, as.polygons
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)
}
## with a matrix
s <- cbind(1:5, 1:5)
e <- cbind(1:5, 0)
as.lines(s)
as.lines(cbind(s, e), "+proj=longlat")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.