as.points {terra} | R Documentation |
Conversion to a SpatVector of points
Description
Conversion of a SpatRaster, SpatVector or SpatExtent to a SpatVector of points.
Usage
## S4 method for signature 'SpatRaster'
as.points(x, values=TRUE, na.rm=TRUE, na.all=FALSE)
## S4 method for signature 'SpatVector'
as.points(x, multi=FALSE, skiplast=TRUE)
## S4 method for signature 'SpatExtent'
as.points(x, crs="")
Arguments
x |
SpatRaster, SpatVector or SpatExtent |
values |
logical; include cell values as attributes? |
multi |
logical. If |
skiplast |
logical. If |
na.rm |
logical. If |
na.all |
logical. If |
crs |
character. The coordinate reference system (see |
Value
SpatVector
See Also
Examples
r <- rast(ncols=2, nrows=2)
values(r) <- 1:ncell(r)
as.points(r)
if (gdal() >= "3.0.0") {
p <- as.polygons(r)
as.points(p)
}
[Package terra version 1.7-78 Index]