diff --git a/python/plugins/processing/algs/gdal/Buffer.py b/python/plugins/processing/algs/gdal/Buffer.py index d3f23497bf44..ab1a3b115142 100644 --- a/python/plugins/processing/algs/gdal/Buffer.py +++ b/python/plugins/processing/algs/gdal/Buffer.py @@ -100,9 +100,12 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): if source is None: raise QgsProcessingException(self.invalidSourceError(parameters, self.INPUT)) fields = source.fields() - source_details = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing) - - geometry = self.parameterAsString(parameters, self.GEOMETRY, context) + source_details = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing=True) + # QgsVectorFileWriter defaults to geometry column called geom when exporting virtual, memory and grass layer + if source_details.layer_name == 'INPUT' and 'INPUT.gpkg' in source_details.connection_string: + geometry = parameters[self.GEOMETRY] = 'geom' + else: + geometry = self.parameterAsString(parameters, self.GEOMETRY, context) distance = self.parameterAsDouble(parameters, self.DISTANCE, context) fieldName = self.parameterAsString(parameters, self.FIELD, context) dissolve = self.parameterAsBoolean(parameters, self.DISSOLVE, context) @@ -122,6 +125,7 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments = [ output_details.connection_string, source_details.connection_string, + '-nlt PROMOTE_TO_MULTI', '-dialect', 'sqlite', '-sql' diff --git a/python/plugins/processing/algs/gdal/GdalAlgorithm.py b/python/plugins/processing/algs/gdal/GdalAlgorithm.py index d896673a45ca..d4bdc52c8529 100644 --- a/python/plugins/processing/algs/gdal/GdalAlgorithm.py +++ b/python/plugins/processing/algs/gdal/GdalAlgorithm.py @@ -84,7 +84,7 @@ def getOgrCompatibleSource(self, parameters = {parameter_name: parameters[parameter_name].source} input_layer = self.parameterAsVectorLayer(parameters, parameter_name, context) - if input_layer is None or input_layer.providerType() in ('memory', 'grass'): + if input_layer is None or input_layer.providerType() in ('virtual', 'memory', 'grass'): if executing: # parameter is not a vector layer - try to convert to a source compatible with OGR # and extract selection if required