3

I'm trying to conduct raster analysis in QGIS on a digital elevation model with a grid resolution of 5 cm. The disk size for the data set is 151 MB. When using default GDAL raster calculator it throws an error " Raster Calculator: Insufficient memory available for operation."

Can anyone suggest alternatives to QGIS raster calculator?

PS- I have tried using SAGA Grid calculator but on the import of the same dataset in SAGA, the software crashes.

The following are the hardware specifications of my desktop:

AMD FX6300 six core 3.5GHz

Installed RAM 4.0 GB (3.5 GB usable)

64-bit operating system

Raster info:

Driver GDAL provider GTiff
GeoTIFF
Dataset Description
E:\QGIS\practice_content\terrain_analysis_mining\new_files\DSM.tif
AREA_OR_POINT=Area
TIFFTAG_SOFTWARE=pix4dmapper
Band 1
STATISTICS_MAXIMUM=79.582763671875
STATISTICS_MEAN=52.49497241844
STATISTICS_MINIMUM=34.057125091553
STATISTICS_STDDEV=10.220585082683
Dimensions
X: 14249 Y: 26318 Bands: 1
Origin
408714,1.6928e+06
Pixel Size
0.05142,-0.05142
No Data Value
-10000
Data Type
Float32 - Thirty two bit floating point
Pyramid overviews
Layer Spatial Reference System
+proj=utm +zone=43 +datum=WGS84 +units=m +no_defs
Layer Extent (layer original source projection)
408713.6688200000207871,1691448.5592900000046939 : 409446.3524000000325032,1692801.8308500000275671
Band
Band 1
Band No
1
No Stats
No stats collected yet

Tab_surv
  • 31
  • 3

2 Answers2

2

Try to divide raster into parts and then use raster calculator - your DEM is very high detailed and huge, I mean

Jane
  • 1,066
  • 7
  • 20
  • The raster represents an area of only 100 acres but the GSD is 5 cm – Tab_surv Jun 29 '17 at 16:33
  • Hence tiling is not a feasible option. – Tab_surv Jun 29 '17 at 16:40
  • 1
    You mention in your question that the DEM raster is 141 MB. However I see in the gdaliinfo output that it's 14,000 x 26,000 pixels, and with data type float 32. If my calculation is correct, that should be about 3 GB ?? – Micha Jun 30 '17 at 07:17
1

Your image is way too big to process with 4GB RAM. I used to process UAS rasters of similar size, but I was using a workstation with 64GB RAM. I'm pretty sure you'll need at least 8GB, maybe 16GB RAM, to load a raster that size in-memory.

As @micha said, the size is a lot larger than you think, the image will take 1.5GB (using a 32 bit OS) up to a worst-case of 3Gb (with 64 bit OS). As an absolute minimum, 14249 x 26318 x 4 x 1 = 1,500,020,728 bytes (1.5 GB)

Your best bet is to split the raster into tiles as @Jane suggested. This question has some answers which might help.

You could also try r.mapcalc which should be available using the Processing toolbar. I've not tried this on a raster this size, but it's worth a try.

enter image description here

Provided your raster calculator function doesn't rely on neighbouring pixels' values, you can use Build Virtual Raster (Catalog) to re-combine the processed tiles afterwards.

Steven Kay
  • 20,405
  • 5
  • 31
  • 82
  • Thanks, @Steven. Actually, the info above is for uncompressed raster which occupies 1.34GB disk space. I'm using a 32-bit QGIS version on a 4GB RAM system hence the issue. Tried, the same on a 16GB RAM i7 with NVIDIA GTX 780 and the same operation could be performed on default QGIS raster calculator. – Tab_surv Jul 01 '17 at 11:22