GDAL_resample: Resample raster

Description Usage Arguments Value Examples

View source: R/GDAL_resample.R

Description

Function does a system call to run gdal functions (works on unix systems where gdal can be called from terminal). Use only file path, function will not work with raster objects loaded in R environment.

Usage

1
2
GDAL_resample(infile, outfile, target_resolution, method,
  large_tif = FALSE, return_raster = FALSE)

Arguments

infile

Raster to be cropped (file path or Raster object). Input raster should be stored on disk for GDAL access.

outfile

Path and filename of the mosaicked output (format "E:/Folder/file.tif").

target_resolution

New resolution of raster.

method

Resampling method. One in c("near", "bilinear", "cubic", "cubicspline", "lanczos", "average", "mode", "max", "min", "med", "q1", "q3").

large_tif

Use large_tif = TRUE for large rasters (>4GB).

return_raster

Logical. The function stores the raster in the filename argument path as a side-effect.

Value

Raster object. Only if return_raster = TRUE. Otherwise, the function side-effect is to save the file locally.

Examples

1
2
3
4
5
6
lc_info <- "/vol/milkun1/Mirza_Cengic/Data_RAW/ESA_CCI/TIFF/YearByYear/ESACCI-LC-L4-LCCS-Map-300m-P1Y-2002-v2.0.7.tif"
out <- "/vol/milkun1/Mirza_Cengic/Projects/Land_use/Data/Predictors/Resampled/Soil_GDAL/Soil_AWCh.tif"
awch <- "/vol/milkun1/Mirza_Cengic/Projects/Land_use/Data/Predictors/Original/Soil/Soil_AWCh.tif"
res_lc <- rgdal::GDALinfo(lc_info)["res.x"]
GDAL_resample(awch, outfile = out,
target_resolution = res_lc, method = "average", large_tif = TRUE)

MirzaCengic/gdalR documentation built on July 26, 2019, 11:36 p.m.