added error handling for too big rasters

I ran into memory problems with big rasters. Now the error message points the user to this potential error source.
This commit is contained in:
anitagraser 2014-03-31 15:45:26 +02:00
parent 04d7169e0e
commit 9ef91a222c

View File

@ -95,7 +95,11 @@ for i in xrange(bandCount):
progress.setPercentage(int(current * total))
rasterBand = raster.GetRasterBand(i + 1)
data = rasterBand.ReadAsArray()
try:
data = rasterBand.ReadAsArray()
except:
raise GeoAlgorithmExecutionException(
'Error reading raster data. File might be too big.')
layer.ResetReading()
feature = layer.GetNextFeature()
while feature is not None: