Skip to content

Commit

Permalink
Fix vector file formats show in processing options for raster output
Browse files Browse the repository at this point in the history
extension (fix #16894)
  • Loading branch information
nyalldawson committed Jul 26, 2017
1 parent a95cbe9 commit a48c146
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions python/plugins/processing/algs/gdal/GdalUtils.py 100644 → 100755
Expand Up @@ -45,13 +45,13 @@

try:
from osgeo import gdal # NOQA

gdalAvailable = True
except:
gdalAvailable = False


class GdalUtils(object):

GDAL_HELP_PATH = 'GDAL_HELP_PATH'

supportedRasters = None
Expand Down Expand Up @@ -106,7 +106,9 @@ def runGdal(commands, feedback=None):
if retry_count < 5:
retry_count += 1
else:
raise IOError(e.message + u'\nTried 5 times without success. Last iteration stopped after reading {} line(s).\nLast line(s):\n{}'.format(len(loglines), u'\n'.join(loglines[-10:])))
raise IOError(
e.message + u'\nTried 5 times without success. Last iteration stopped after reading {} line(s).\nLast line(s):\n{}'.format(
len(loglines), u'\n'.join(loglines[-10:])))

QgsMessageLog.logMessage('\n'.join(loglines), 'Processing', QgsMessageLog.INFO)
GdalUtils.consoleOutput = loglines
Expand Down Expand Up @@ -134,6 +136,10 @@ def getSupportedRasters():
continue
shortName = driver.ShortName
metadata = driver.GetMetadata()
if gdal.DCAP_RASTER not in metadata \
or metadata[gdal.DCAP_RASTER] != 'YES':
continue

# ===================================================================
# if gdal.DCAP_CREATE not in metadata \
# or metadata[gdal.DCAP_CREATE] != 'YES':
Expand Down Expand Up @@ -183,7 +189,7 @@ def escapeAndJoin(strList):
for s in strList:
if s and s[0] != '-' and ' ' in s:
escaped = '"' + s.replace('\\', '\\\\').replace('"', '\\"') \
+ '"'
+ '"'
else:
escaped = s
joined += escaped + ' '
Expand Down

0 comments on commit a48c146

Please sign in to comment.