Skip to content

Commit 9ef91a2

Browse files
committedMar 31, 2014
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.
1 parent 04d7169 commit 9ef91a2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎python/plugins/processing/script/scripts/Extract_raster_values_to_shapefile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@
9595
progress.setPercentage(int(current * total))
9696

9797
rasterBand = raster.GetRasterBand(i + 1)
98-
data = rasterBand.ReadAsArray()
98+
try:
99+
data = rasterBand.ReadAsArray()
100+
except:
101+
raise GeoAlgorithmExecutionException(
102+
'Error reading raster data. File might be too big.')
99103
layer.ResetReading()
100104
feature = layer.GetNextFeature()
101105
while feature is not None:

0 commit comments

Comments
 (0)
Please sign in to comment.