Skip to content

Commit f66646c

Browse files
committed
[processing] remove code with GDAL 1.x API as QGIS 3 will require GDAL 2.x
1 parent 5489f85 commit f66646c

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

python/plugins/processing/algs/gdal/warp.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ def defineCharacteristics(self):
9090
self.tr('Raster extent'),
9191
optional=True))
9292

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

9897
self.addParameter(ParameterString(self.OPTIONS,
9998
self.tr('Additional creation options'),
@@ -151,10 +150,9 @@ def getConsoleCommands(self):
151150
arguments.append(regionCoords[1])
152151
arguments.append(regionCoords[3])
153152

154-
if GdalUtils.version() >= 2000000:
155-
if rastext_crs:
156-
arguments.append('-te_srs')
157-
arguments.append(rastext_crs)
153+
if rastext_crs:
154+
arguments.append('-te_srs')
155+
arguments.append(rastext_crs)
158156

159157
if opts:
160158
arguments.append('-co')

python/plugins/processing/tools/raster.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,8 @@ def scanraster(layer, feedback):
104104

105105

106106
def mapToPixel(mX, mY, geoTransform):
107-
try:
108-
# GDAL 1.x
109-
(pX, pY) = gdal.ApplyGeoTransform(
110-
gdal.InvGeoTransform(geoTransform)[1], mX, mY)
111-
except TypeError:
112-
# GDAL 2.x
113-
(pX, pY) = gdal.ApplyGeoTransform(
114-
gdal.InvGeoTransform(geoTransform), mX, mY)
107+
(pX, pY) = gdal.ApplyGeoTransform(
108+
gdal.InvGeoTransform(geoTransform), mX, mY)
115109
return (int(pX), int(pY))
116110

117111

0 commit comments

Comments
 (0)