View source: R/06-spatial-join.R
| raster_to_raster_ops | R Documentation |
Specialized function for mathematical and overlay operations between rasters. Handles alignment, projection, and complex operations with comprehensive error handling and performance optimization.
raster_to_raster_ops(
raster1,
raster2,
operation = "overlay",
align_method = "resample",
summary_function = "mean",
handle_na = "propagate",
mask_value = NA,
output_file = NULL,
verbose = FALSE
)
raster1 |
First raster (SpatRaster or file path) |
raster2 |
Second raster (SpatRaster or file path) |
operation |
Character. Mathematical operation:
|
align_method |
Character. How to align mismatched rasters:
|
summary_function |
Character. Function for overlay operation |
handle_na |
Character. How to handle NA values:
|
mask_value |
Numeric. Value to use for masking (default: NA) |
output_file |
Character. Optional output file path |
verbose |
Logical. Print processing details |
SpatRaster with operation results
## Not run:
# These examples require external data files not included with the package
# Mathematical operations
sum_raster <- raster_to_raster_ops("ndvi.tif", "evi.tif", "add")
diff_raster <- raster_to_raster_ops("before.tif", "after.tif", "subtract")
# Masking operations
masked <- raster_to_raster_ops("data.tif", "mask.tif", "mask")
# Complex overlay with alignment
overlay <- raster_to_raster_ops(
raster1 = "fine_res.tif",
raster2 = "coarse_res.tif",
operation = "overlay",
align_method = "resample",
summary_function = "mean",
verbose = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.