Skip to content

Commit

Permalink
Merge pull request #4122 from alexbruy/processing-gdal2
Browse files Browse the repository at this point in the history
[processing] remove code with  GDAL 1.x API calls
  • Loading branch information
alexbruy committed Feb 9, 2017
2 parents 2c188b2 + f66646c commit 2ea3ac4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
14 changes: 6 additions & 8 deletions python/plugins/processing/algs/gdal/warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@ def defineCharacteristics(self):
self.tr('Raster extent'),
optional=True))

if GdalUtils.version() >= 2000000:
self.addParameter(ParameterCrs(self.EXT_CRS,
self.tr('CRS of the raster extent, leave blank for using Destination SRS'),
optional=True))
self.addParameter(ParameterCrs(self.EXT_CRS,
self.tr('CRS of the raster extent, leave blank for using Destination SRS'),
optional=True))

self.addParameter(ParameterString(self.OPTIONS,
self.tr('Additional creation options'),
Expand Down Expand Up @@ -151,10 +150,9 @@ def getConsoleCommands(self):
arguments.append(regionCoords[1])
arguments.append(regionCoords[3])

if GdalUtils.version() >= 2000000:
if rastext_crs:
arguments.append('-te_srs')
arguments.append(rastext_crs)
if rastext_crs:
arguments.append('-te_srs')
arguments.append(rastext_crs)

if opts:
arguments.append('-co')
Expand Down
10 changes: 2 additions & 8 deletions python/plugins/processing/tools/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,8 @@ def scanraster(layer, feedback):


def mapToPixel(mX, mY, geoTransform):
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)
(pX, pY) = gdal.ApplyGeoTransform(
gdal.InvGeoTransform(geoTransform), mX, mY)
return (int(pX), int(pY))


Expand Down

0 comments on commit 2ea3ac4

Please sign in to comment.