Description Usage Arguments Value See Also Examples
getValuesBlock returns values for a block (rectangular area) of values of a Raster* object.
1 2 3 4 5 6 7 8 | ## S4 method for signature 'RasterLayer'
getValuesBlock(x, row=1, nrows=1, col=1, ncols=(ncol(x)-col+1), format='', ...)
## S4 method for signature 'RasterBrick'
getValuesBlock(x, row=1, nrows=1, col=1, ncols=(ncol(x)-col+1), lyrs, ...)
## S4 method for signature 'RasterStack'
getValuesBlock(x, row=1, nrows=1, col=1, ncols=(ncol(x)-col+1), lyrs, ...)
|
x |
Raster* object |
row |
positive integer. Row number to start from, should be between 1 and nrow(x) |
nrows |
positive integer. How many rows? Default is 1 |
col |
positive integer. Column number to start from, should be between 1 and ncol(x) |
ncols |
positive integer. How many columns? Default is the number of columns left after the start column |
format |
character. When |
lyrs |
integer (vector). Which layers? Default is all layers ( |
... |
additional arguments (none implemented) |
matrix or vector (if (x=RasterLayer)
, unless format='matrix'
)
1 2 3 4 5 6 7 8 | r <- raster(system.file("external/test.grd", package="raster"))
b <- getValuesBlock(r, row=100, nrows=3, col=10, ncols=5)
b
b <- matrix(b, nrow=3, ncol=5, byrow=TRUE)
b
logo <- brick(system.file("external/rlogo.grd", package="raster"))
getValuesBlock(logo, row=35, nrows=3, col=50, ncols=3, lyrs=2:3)
|
Loading required package: sp
[1] 454.412 440.488 421.193 396.460 365.566 483.079 467.769 444.945 418.093
[10] 390.002 532.368 513.638 481.389 446.935 416.298
[,1] [,2] [,3] [,4] [,5]
[1,] 454.412 440.488 421.193 396.460 365.566
[2,] 483.079 467.769 444.945 418.093 390.002
[3,] 532.368 513.638 481.389 446.935 416.298
green blue
[1,] 168 220
[2,] 176 231
[3,] 175 226
[4,] 167 219
[5,] 176 230
[6,] 175 226
[7,] 167 219
[8,] 176 230
[9,] 175 224
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.