dsn <- system.file("extdata/sst.tif", package = "vapour")
par(mfrow = c(2, 2))
## do nothing, get native
X <- gdal_raster_data(dsn)
## set resolution (or dimension, extent, crs, or combination thereof - GDAL
## will report/resolve incompatible opts)
X1 <- gdal_raster_data(dsn, target_res = 1)
## add a cutline, and cut to it using gdal warp args
cutline <- system.file("extdata/cutline_sst.gpkg", package = "vapour")
X1c <- gdal_raster_data(dsn, target_res = .1, options = c("-cutline",cutline, "-crop_to_cutline" ))
## warp whole grid to give res
X2 <- gdal_raster_data(dsn, target_res = 25000, target_crs = "EPSG:32755")
## specify exactly (as per vapour originally)
X3 <- gdal_raster_data(dsn, target_ext = c(-1, 1, -1, 1) * 8e6,
target_dim = c(512, 678), target_crs = "+proj=stere +lon_0=147 +lat_0=-90")
X4 <- gdal_raster_dsn(dsn, out_dsn = tempfile(fileext = ".tif"))
Run the code above in your browser using DataLab