as.list {terra} | R Documentation |
Coerce a SpatRaster, SpatRasterCollection, or SpatVector to a list. With a SpatRaster, each layer becomes a list element. With a SpatRasterCollection, each SpatRaster becomes a list element. With a SpatVector, each variable (attribute) becomes a list element.
## S4 method for signature 'SpatRaster'
as.list(x, ...)
## S4 method for signature 'SpatRasterCollection'
as.list(x, ...)
## S4 method for signature 'SpatVector'
as.list(x, geom=NULL, ...)
x |
SpatRaster or SpatVector |
geom |
character or NULL. If not NULL, either "WKT" or "HEX", to get the geometry included in Well-Known-Text or hexadecimal notation. If |
... |
Additional arguments. These are ignored |
list
see coerce
for as.data.frame
with a SpatRaster; and geom
to only extract the geometry of a SpatVector
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
as.list(v)