Skip to content
Permalink
Browse files

processing: add extent parameter to gdal_warp

  • Loading branch information
Giovanni Manghi
Giovanni Manghi committed Mar 10, 2016
1 parent 9b35a98 commit b073111f8a920a2ab2d49a26350485f4e56c1522
Showing with 17 additions and 1 deletion.
  1. 0 1
  2. +17 −1 python/plugins/processing/algs/gdal/warp.py
0 1
No changes.
@@ -31,6 +31,7 @@

from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.core.parameters import ParameterRaster
from processing.core.parameters import ParameterExtent
from processing.core.parameters import ParameterSelection
from processing.core.parameters import ParameterCrs
from processing.core.parameters import ParameterNumber
@@ -64,6 +65,7 @@ class warp(GdalAlgorithm):
BIGTIFFTYPE = ['', 'YES', 'NO', 'IF_NEEDED', 'IF_SAFER']
COMPRESSTYPE = ['NONE', 'JPEG', 'LZW', 'PACKBITS', 'DEFLATE']
TFW = 'TFW'
RAST_EXT = 'RAST_EXT'

def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'warp.png'))
@@ -84,6 +86,7 @@ def defineCharacteristics(self):
0.0, None, 0.0))
self.addParameter(ParameterSelection(self.METHOD,
self.tr('Resampling method'), self.METHOD_OPTIONS))
self.addParameter(ParameterExtent(self.RAST_EXT, self.tr('Raster extent')))

params = []
params.append(ParameterSelection(self.RTYPE,
@@ -125,7 +128,8 @@ def getConsoleCommands(self):
compress = self.COMPRESSTYPE[self.getParameterValue(self.COMPRESS)]
bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
tfw = unicode(self.getParameterValue(self.TFW))

rastext = unicode(self.getParameterValue(self.RAST_EXT))

arguments = []
arguments.append('-ot')
arguments.append(self.TYPE[self.getParameterValue(self.RTYPE)])
@@ -149,6 +153,18 @@ def getConsoleCommands(self):
arguments.append(unicode(self.getParameterValue(self.TR)))
arguments.append(unicode(self.getParameterValue(self.TR)))
extra = unicode(self.getParameterValue(self.EXTRA))
regionCoords = rastext.split(',')
try:
rastext = []
rastext.append('-te')
rastext.append(regionCoords[0])
rastext.append(regionCoords[2])
rastext.append(regionCoords[1])
rastext.append(regionCoords[3])
except IndexError:
rastext = []
if rastext:
arguments.extend(rastext)
if len(extra) > 0:
arguments.append(extra)
if GdalUtils.getFormatShortNameFromFilename(out) == "GTiff":

0 comments on commit b073111

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