# NOT RUN {
library(terra)
r <- rast(nrows=5, ncols=5, vals=1:25)
# create a temporary filename for the example
f <- file.path(tempdir(), "test.tif")
writeRaster(r, f, overwrite=TRUE)
writeRaster(r, f, overwrite=TRUE, gdal=c("COMPRESS=NONE", "TFW=YES","of=COG"), datatype='INT1U')
## Or with a wopt argument:
writeRaster(r, f, overwrite=TRUE, wopt= list(gdal=c("COMPRESS=NONE", "of=COG"), datatype='INT1U'))
## remove the file
unlink(f)
# }
Run the code above in your browser using DataLab