Skip to content
Permalink
Browse files

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

  • Loading branch information
alexbruy committed May 23, 2016
1 parent 26c3ece commit 44c948b014e8009020dbc68d8842f3bf2748197c
Showing with 8 additions and 2 deletions.
  1. +8 −2 python/plugins/processing/tools/raster.py
@@ -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))


0 comments on commit 44c948b

Please sign in to comment.
You can’t perform that action at this time.