[processing] add support for GDAL 2.x in raster tools (refs #14858)

This commit is contained in:
Alexander Bruy 2016-05-23 18:15:46 +03:00
parent 26c3ece49e
commit 44c948b014

View File

@ -64,8 +64,14 @@ def scanraster(layer, progress):
def mapToPixel(mX, mY, geoTransform):
(pX, pY) = gdal.ApplyGeoTransform(
gdal.InvGeoTransform(geoTransform)[1], mX, mY)
try:
# GDAL 1.x
(pX, pY) = gdal.ApplyGeoTransform(
gdal.InvGeoTransform(geoTransform)[1], mX, mY)
except TypeError:
# GDAL 2.x
(pX, pY) = gdal.ApplyGeoTransform(
gdal.InvGeoTransform(geoTransform), mX, mY)
return (int(pX), int(pY))