Skip to content

Commit 2ce4b8a

Browse files
committedMar 9, 2016
Merge pull request #2883 from radosuav/zonal_statistics_fix
[Processing] Fix TypeError in Zonal Statistics algorithm
2 parents 5bb1723 + 9c611c9 commit 2ce4b8a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎python/plugins/processing/tools/raster.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,14 @@ def scanraster(layer, progress):
6464

6565

6666
def mapToPixel(mX, mY, geoTransform):
67-
(pX, pY) = gdal.ApplyGeoTransform(
68-
gdal.InvGeoTransform(geoTransform)[1], mX, mY)
67+
try:
68+
# GDAL 1.x
69+
(pX, pY) = gdal.ApplyGeoTransform(
70+
gdal.InvGeoTransform(geoTransform)[1], mX, mY)
71+
except TypeError:
72+
# GDAL 2.x
73+
(pX, pY) = gdal.ApplyGeoTransform(
74+
gdal.InvGeoTransform(geoTransform), mX, mY)
6975
return (int(pX), int(pY))
7076

7177

0 commit comments

Comments
 (0)
Please sign in to comment.