Skip to content

Commit d43245c

Browse files
authoredFeb 25, 2021
[processing] Fix sort order of output raster extensions list
to make it easier to find the extension in the long list of available extensions in the "Save to File" window of the GDAL provider algorithms
1 parent 91c8b23 commit d43245c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed
 

‎python/plugins/processing/algs/gdal/GdalUtils.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ def getSupportedRasters():
170170

171171
GdalUtils.supportedRasters = {}
172172
GdalUtils.supportedOutputRasters = {}
173-
GdalUtils.supportedRasters['GTiff'] = ['tif']
174-
GdalUtils.supportedOutputRasters['GTiff'] = ['tif']
173+
GdalUtils.supportedRasters['GTiff'] = ['tif', 'tiff']
174+
GdalUtils.supportedOutputRasters['GTiff'] = ['tif', 'tiff']
175175

176176
for i in range(gdal.GetDriverCount()):
177177
driver = gdal.GetDriver(i)
@@ -210,20 +210,24 @@ def getSupportedOutputRasters():
210210

211211
@staticmethod
212212
def getSupportedRasterExtensions():
213-
allexts = ['tif']
213+
allexts = []
214214
for exts in list(GdalUtils.getSupportedRasters().values()):
215215
for ext in exts:
216-
if ext not in allexts and ext != '':
216+
if ext not in allexts and ext not in ['', 'tif', 'tiff']:
217217
allexts.append(ext)
218+
allexts.sort()
219+
allexts[0:0] = ['tif', 'tiff']
218220
return allexts
219221

220222
@staticmethod
221223
def getSupportedOutputRasterExtensions():
222-
allexts = ['tif']
224+
allexts = []
223225
for exts in list(GdalUtils.getSupportedOutputRasters().values()):
224226
for ext in exts:
225-
if ext not in allexts and ext != '':
227+
if ext not in allexts and ext not in ['', 'tif', 'tiff']:
226228
allexts.append(ext)
229+
allexts.sort()
230+
allexts[0:0] = ['tif', 'tiff']
227231
return allexts
228232

229233
@staticmethod

0 commit comments

Comments
 (0)
Please sign in to comment.