Skip to content

Commit a80535b

Browse files
backporting[bot]3nids
authored andcommitted
Backport #9640 on release-3_4: [processing] Refine check for usable layers (#9642)
* [processing] Refine check for usable layers - allow WMS layers and other non-GDAL raster layers. This will work fine for native algorithms, likely not work for other providers. They will need to be adapted to throw errors when incompatible raster layer providers are used - invalid layers are not permitted (e.g. those with missing data sources) * Remove outdated comment
1 parent 538e790 commit a80535b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/core/processing/qgsprocessingutils.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,12 @@ QgsProcessingFeatureSource *QgsProcessingUtils::variantToSource( const QVariant
314314

315315
bool QgsProcessingUtils::canUseLayer( const QgsRasterLayer *layer )
316316
{
317-
// only gdal file-based layers
318-
return layer && layer->providerType() == QStringLiteral( "gdal" );
317+
return layer && layer->isValid();
319318
}
320319

321320
bool QgsProcessingUtils::canUseLayer( const QgsVectorLayer *layer, const QList<int> &sourceTypes )
322321
{
323-
return layer &&
322+
return layer && layer->isValid() &&
324323
( sourceTypes.isEmpty()
325324
|| ( sourceTypes.contains( QgsProcessing::TypeVectorPoint ) && layer->geometryType() == QgsWkbTypes::PointGeometry )
326325
|| ( sourceTypes.contains( QgsProcessing::TypeVectorLine ) && layer->geometryType() == QgsWkbTypes::LineGeometry )

0 commit comments

Comments
 (0)