Learn R Programming

terra (version 0.5-2)

compareGeom: Compare geometries of SpatRaster objects

Description

Evaluate whether two SpatRaster objects have the same extent, number of rows and columns, projection, resolution, and origin (or a subset of these comparisons).

Usage

# S4 method for SpatRaster,SpatRaster
compareGeom(x, y, ..., lyrs=TRUE, 
          crs=TRUE, warncrs=FALSE, ext=TRUE, rowcol=TRUE, res=FALSE)

Arguments

x

SpatRaster

y

SpatRaster

...

Additional SpatRaster objects

lyrs

logical. If TRUE, the number of layers is compared

crs

logical. If TRUE, coordinate reference systems are compared.

warncrs

logical. If TRUE, a warning is given if the crs is different (instead of an error)

ext

logical. If TRUE, bounding boxes are compared

rowcol

logical. If TRUE, number of rows and columns of the objects are compared

res

logical. If TRUE, resolutions are compared (redundant when checking extent and rowcol)

Examples

Run this code
# NOT RUN {
r1 <- rast()
r2 <- rast()
r3 <- rast()
compareGeom(r1, r2, r3)
nrow(r3) <- 10
# }
# NOT RUN {
compareGeom(r1, r3)
# }

Run the code above in your browser using DataLab