.region,missing-method | R Documentation |
These functions either change the extent, dimensions, and/or resolution of a GRASS "region" or report the current region's extent, dimensions, and/or resolution (see vignette("regions", package = "fasterRaster")
). These functions are mostly used internally and rarely of interest to most users.
.region()
: All 2D and 3D aspects of a region.
.regionDim()
: x- and y-dimensions.
.regionExt()
: x- and y-extent.
.regionRes()
: x- and y-resolution.
## S4 method for signature 'missing'
.region(x)
## S4 method for signature 'SpatRaster'
.region(x)
## S4 method for signature 'GRegion'
.region(x)
## S4 method for signature 'GRaster'
.region(x, trim = NULL)
## S4 method for signature 'GVector'
.region(x)
## S4 method for signature 'missing'
.regionExt(x)
## S4 method for signature 'numeric'
.regionExt(x, respect)
## S4 method for signature 'GSpatial'
.regionExt(x, respect)
## S4 method for signature 'missing'
.regionDim(x)
## S4 method for signature 'numeric'
.regionDim(x, respect)
## S4 method for signature 'GRegion'
.regionDim(x, respect)
## S4 method for signature 'missing'
.regionRes(x)
## S4 method for signature 'numeric'
.regionRes(x, respect)
## S4 method for signature 'GRegion'
.regionRes(x, respect)
x |
Any of:
|
trim |
A |
respect |
Character or
In this case, the new region"s registration will be the same as this raster, and cell resolution will be the same Note: In most cases extent cannot be retained exactly if the resolution is changed. When resolution is changed, the actual extent will be the user-supplied extent expanded by zero to one rows or zero to one columns to accommodate an integer number of cells of the desired size. The western and northern limits of the extent will be retained, while the eastern and southern limits of the extent will be moved to accommodate an integer number of columns and rows. |
When resizing extent, terra keeps the xmin
(west) and ymax
(north) the fixed and shifts xmax
(east) and ymin
(south) as needed. To retain as much fidelity between fasterRaster and terra as possible, these functions do the same to the region.
The value returned depends on how the function is used:
If used with no arguments, .region()
returns a GRegion
object.
If used with no arguments, .regionDim()
, .regionExt()
, and .regionRes()
return numeric or integer vectors.
If the function is used to change reshape/resample the region, it returns a GRegion
object reflecting the region before it was changed. This allows users to revert to the original region if desired.
if (grassStarted()) {
# Setup
library(terra)
# Example data
madElev <- fastData("madElev")
madRivers <- fastData("madRivers")
# Report information on current region:
dim3d()
nrow()
ncol()
ndepth()
ncell()
ncell3d()
ext()
W()
E()
S()
N()
res()
res3d()
xres()
yres()
zres()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.