# NOT RUN {
library(raster)
## load a file
path_tiff <- "/path/to/file.tiff"
r_tiff <- stack(path_tiff)
## define an AOI
data("aoi_data")
aoi <- aoi_data[[2]] # example AOI
## if necessary, reproject AOI to file CRS
aoi <- spTransform(aoi, crs(r))
## crop (file on disk will not be changed)
r_crop <- cropFAST(path_tiff, ext = aoi)
## crop to a new file
r_crop <- cropFAST(path_tiff, ext = aoi, filename = "/path/to/file_cropped.tiff")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab