Resampling large rasters in terra: best way to resample continental-scale elevation data in R without exhausting RAM
01:02 28 May 2026

I am hoping for some advice regarding manipulating large spatial datasets. I am attempting to resample ~30m resolution terrain data (slope, tpi, etc.) to 100m to match a template raster. I am running into some troubles as these have very large extent (whole of Australia) and consequently there are billions of cells.

I need my terrain variables to be match the extent, resolution, etc of the template and want to do this using summary statistics (mean and SD) rather than just resampling from 30m to 100m. I started by reprojecting the DEM to the desired projected reference system (EPSG:9473) and then derived the terrain variables using the terrain() function.

I have tried to use the zonal() function to calculate summary statistics of the overlapping 30m cells within the 100m cell... but I got this error [std::bad_alloc] which I believe means I ran out of RAM.

Does anyone have any recommendations? Is there a way to circumvent the RAM issues I encountered via zonal statistics? Would ArcGIS be more effective for this? Should I aggregate the initial DEM to 100m and then derive terrain variables? I am relatively new to using geospatial data and R so any help would be greatly appreciated :)

r geospatial large-data terra resample