asgrid and rast() | R Documentation |
Make grids from objects of type: matrix
and SpatRaster
(defined interra).
asgrid(x, ...) # generic
## S3 method for class 'matrix'
asgrid(x, xll, yll, cellsize, ...)
## S3 method for class 'SpatRaster'
asgrid(x, ...)
## S4 method for signature 'grid'
rast(x)
x |
an object of class |
xll, yll |
the x and y coordinates of the lower left corner of the lower left cell of the grid. |
cellsize |
the cellsize of the grid |
... |
Arguments to be passed to other methods. |
For asgrid
an object of class grid
which is a list containing
the following elements.
m |
a matrix containing the data from |
nrow, ncol |
the number of rows and column in |
xll, yll |
the x an y coordinates of the lower left corner of the lower left cell in the matrix. |
cellsize |
the horizontal and vertical dimension of cells in the grid; cells must be square. |
For rast
a SpatRaster
.
Ethan Plunkett
Input classes of x
are defined in rast
# Matrix method
mat <- matrix(1:20, 4, 5)
g <- asgrid(mat, cellsize=10, xll=0, yll=0)
g
# To and from SpatRaster (terra::rast())
library(terra)
r <- rast(g)
g2 <- asgrid(r)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.