Skip to content

Commit

Permalink
[processing] remove code with GDAL 1.x API as QGIS 3 will require GDA…
Browse files Browse the repository at this point in the history
…L 2.x
  • Loading branch information
alexbruy committed Feb 9, 2017
1 parent 5489f85 commit f66646c
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 f66646c

Please sign in to comment.