Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/getValuesBlock_enhanced.R
Easier-to-use function for grabbing a block of data out of a Raster*.
1 2 |
x |
Raster* Some input Raster* object. |
r1 |
Numeric. The start row of the chunk. |
r2 |
Numeric. The end row of the chunk. |
c1 |
Numeric. The start column of the chunk. |
c2 |
Numeric. The end row of the chunk. |
lyrs |
Numeric. Vector of layer IDs. Defaults to all layers (1:nlayers(x)). |
format |
Character. See Details. |
... |
Other parameters. |
This allows for a larger number of output formats to be generated when extracting chunks of data from a Raster* object. If format="array" (default), the chunk will be returned in a 3-d array with dimensions representing column,row,and layer. If "raster", the chunk will be returned as a Raster* object. If "data.frame", it will be returned as a data.frame. If "data.frame.dims", it will return a list, where the first component (named "values") is the same as the data.frame when using format="data.frame", and the second component (named "dim") is the dimensions of the extracted chunk.
An array or raster object.
Jonathan A. Greenberg
1 2 3 4 5 6 7 | library("raster")
tahoe_highrez <- brick(system.file("external/tahoe_highrez.tif", package="spatial.tools"))
mychunk <- getValuesBlock_enhanced(tahoe_highrez,r1=100,r2=110,c1=20,c2=50)
class(mychunk)
dim(mychunk)
mychunk_raster <- getValuesBlock_enhanced(tahoe_highrez,r1=100,r2=110,c1=20,c2=50,format="raster")
mychunk_raster
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.