Skip to content
Permalink
Browse files

Merge pull request #4122 from alexbruy/processing-gdal2

[processing] remove code with  GDAL 1.x API calls
  • Loading branch information
alexbruy committed Feb 9, 2017
2 parents 2c188b2 + f66646c commit 2ea3ac4611718532db9207a53e16a1614570221e
Showing with 8 additions and 16 deletions.
  1. +6 −8 python/plugins/processing/algs/gdal/warp.py
  2. +2 −8 python/plugins/processing/tools/raster.py
@@ -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'),
@@ -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')
@@ -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))


0 comments on commit 2ea3ac4

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