Skip to content

Commit 34df72c

Browse files
author
radosuav
committed
[Processing] Use raster band scailing factor and offset in Zonal Statistics algorithm
1 parent 57eb409 commit 34df72c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

python/plugins/processing/algs/qgis/ZonalStatistics.py

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def processAlgorithm(self, progress):
118118

119119
srcOffset = (startColumn, startRow, width, height)
120120
srcArray = rasterBand.ReadAsArray(*srcOffset)
121+
srcArray = srcArray*rasterBand.GetScale()+rasterBand.GetOffset()
121122

122123
newGeoTransform = (
123124
geoTransform[0] + srcOffset[0] * geoTransform[1],
@@ -192,6 +193,7 @@ def processAlgorithm(self, progress):
192193

193194
srcOffset = (startColumn, startRow, width, height)
194195
srcArray = rasterBand.ReadAsArray(*srcOffset)
196+
srcArray = srcArray*rasterBand.GetScale()+rasterBand.GetOffset()
195197

196198
newGeoTransform = (
197199
geoTransform[0] + srcOffset[0] * geoTransform[1],

0 commit comments

Comments
 (0)