Better approach for preferredFormat

This commit is contained in:
Alexandre Neto 2019-10-03 07:23:03 +01:00 committed by Nyall Dawson
parent 6918f230b8
commit 28b24bda51

View File

@ -87,13 +87,9 @@ class GdalAlgorithm(QgsProcessingAlgorithm):
if executing:
# parameter is not a vector layer - try to convert to a source compatible with OGR
# and extract selection if required
if 'gpkg' in QgsVectorFileWriter.supportedFormatExtensions():
preferred_format = 'gpkg'
else:
preferred_format = 'shp'
ogr_data_path = self.parameterAsCompatibleSourceLayerPath(parameters, parameter_name, context,
QgsVectorFileWriter.supportedFormatExtensions(),
preferred_format,
QgsVectorFileWriter.supportedFormatExtensions()[0],
feedback=feedback)
ogr_layer_name = GdalUtils.ogrLayerName(ogr_data_path)
else: