Skip to content
Permalink
Browse files

Make Extent and Extent CRS GDAL parameters optional

Specify what the default is when extent CRS is not specified.
Allow using "auto" to have extent automatically set to min covering extent.

Fixes #15685
  • Loading branch information
strk committed Oct 19, 2016
1 parent ea0ad5d commit 06976a2e87737c755f5783243e09185e7c872e06
@@ -92,7 +92,8 @@ def defineCharacteristics(self):

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

params = []
params.append(ParameterSelection(self.RTYPE,
@@ -136,7 +137,7 @@ def getConsoleCommands(self):
compress = self.COMPRESSTYPE[self.getParameterValue(self.COMPRESS)]
bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
tfw = str(self.getParameterValue(self.TFW))
rastext = str(self.getParameterValue(self.RAST_EXT))
rastext = self.getParameterValue(self.RAST_EXT)
rastext_crs = self.getParameterValue(self.EXT_CRS)

arguments = []
@@ -174,11 +175,9 @@ def getConsoleCommands(self):
rastext.append(regionCoords[3])
except IndexError:
rastext = []
if rastext:
arguments.extend(rastext)

if GdalUtils.version() >= 2000000:
if rastext and rastext_crs is not None:
if rastext and rastext_crs:
arguments.append('-te_srs')
arguments.append(rastext_crs)

@@ -348,7 +348,7 @@ def __init__(self, name='', description='', default=None, optional=True):
# The value is a string in the form "xmin, xmax, ymin, ymax"

def setValue(self, value):
if value is None:
if not value:
if not self.optional:
return False
self.value = None
@@ -59,7 +59,7 @@ def __init__(self, dialog, param):
if self.param.optional:
if hasattr(self.leText, 'setPlaceholderText'):
self.leText.setPlaceholderText(
self.tr('[Leave blank to use min covering extent]'))
self.tr('[Use "auto" to use min covering extent]'))

self.btnSelect.clicked.connect(self.selectExtent)

@@ -104,7 +104,7 @@ def selectExtent(self):
popupmenu.exec_(QCursor.pos())

def useMinCoveringExtent(self):
self.leText.setText('')
self.leText.setText('auto')

def useLayerExtent(self):
CANVAS_KEY = 'Use canvas extent'
@@ -153,7 +153,7 @@ def setValueFromRect(self, r):
self.dialog.activateWindow()

def getValue(self):
if str(self.leText.text()).strip() != '':
if str(self.leText.text()).strip() == '':
return str(self.leText.text())
else:
return None

0 comments on commit 06976a2

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