From c48c8b9ffd1b13d99b938d55acda217cfc5b28ac Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 9 Jul 2024 09:52:27 +1000 Subject: [PATCH 1/2] Allow running processing tools on grass vector layers Remove an outdated constraint preventing processing tools from operating on GRASS provider vector layers. These native QGIS algorithms "just work" with GRASS provider vectors, so there's no reason to explicitly block them anymore... --- src/gui/processing/qgsprocessingmaplayercombobox.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/processing/qgsprocessingmaplayercombobox.cpp b/src/gui/processing/qgsprocessingmaplayercombobox.cpp index 1c84ea75ff4a..00db36729d74 100644 --- a/src/gui/processing/qgsprocessingmaplayercombobox.cpp +++ b/src/gui/processing/qgsprocessingmaplayercombobox.cpp @@ -188,8 +188,6 @@ QgsProcessingMapLayerComboBox::QgsProcessingMapLayerComboBox( const QgsProcessin if ( filters ) mCombo->setFilters( filters ); - mCombo->setExcludedProviders( QStringList() << QStringLiteral( "grass" ) ); // not sure if this is still required... - // Check compatibility with virtualraster data provider // see https://github.com/qgis/QGIS/issues/55890 if ( mayBeRaster && From 4c2983189fec0f78ae34af28fa7e91a426797430 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 9 Jul 2024 09:53:52 +1000 Subject: [PATCH 2/2] When an OGR algorithm is run on a GRASS provider vector layer, export the layer to an OGR compatible source first Use the same logic we use eg for auto-exporting memory layers so that GDAL tools "just work" with GRASS provider vector layers --- python/plugins/processing/algs/gdal/GdalAlgorithm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/plugins/processing/algs/gdal/GdalAlgorithm.py b/python/plugins/processing/algs/gdal/GdalAlgorithm.py index 73baf8d5bfbb..d896673a45ca 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() == 'memory': + if input_layer is None or input_layer.providerType() in ('memory', 'grass'): if executing: # parameter is not a vector layer - try to convert to a source compatible with OGR # and extract selection if required