Conversion to a SpatVector, or to another SpatVector type
Conversion of a SpatRaster or SpatExtent to a SpatVector of points, lines, or polygons;
And conversion of a SpatVector to a another SpatVector type.
## S4 method for signature 'SpatRaster' as.polygons(x, trunc=TRUE, dissolve=TRUE, values=TRUE, na.rm=TRUE, extent=FALSE) ## S4 method for signature 'SpatRaster' as.lines(x) ## S4 method for signature 'SpatRaster' as.points(x, values=TRUE, na.rm=TRUE) ## S4 method for signature 'SpatVector' as.polygons(x) ## S4 method for signature 'SpatVector' as.lines(x) ## S4 method for signature 'SpatVector' as.points(x, multi=FALSE) ## S4 method for signature 'SpatExtent' as.polygons(x, crs="") ## S4 method for signature 'SpatExtent' as.lines(x, crs="") ## S4 method for signature 'SpatExtent' as.points(x, crs="")
x |
SpatRaster or SpatVector |
trunc |
logical; truncate values to integers. Cels with the same value are merged. Therefore, if |
dissolve |
logical; combine cells with the same values? If |
values |
logical; include cell values as attributes? If |
multi |
logical. If |
extent |
logical. if |
na.rm |
logical. If |
crs |
character. The coordinate reference system (see |
SpatVector
r <- rast(ncol=2, nrow=2) values(r) <- 1:ncell(r) as.points(r) as.lines(ext(r), crs=crs(r)) if (gdal() >= "3.0.0") { p <- as.polygons(r) p as.lines(p) as.points(p) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.