Skip to content

Commit 9dd8136

Browse files
committed
Don't show group type layers in AFS source select
These layers cause an error if you try to add them to QGIS. TODO: change source select to use a nested tree and correctly add group layers as a parent for child layers.
1 parent d229ec1 commit 9dd8136

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/providers/arcgisrest/qgsafssourceselect.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,21 @@ bool QgsAfsSourceSelect::connectToService( const QgsOwsConnection &connection )
4747
QStringList layerErrors;
4848
foreach ( const QVariant &layerInfo, serviceInfoMap["layers"].toList() )
4949
{
50-
QVariantMap layerInfoMap = layerInfo.toMap();
50+
const QVariantMap layerInfoMap = layerInfo.toMap();
5151
if ( !layerInfoMap[QStringLiteral( "id" )].isValid() )
5252
{
5353
continue;
5454
}
5555

56+
if ( !layerInfoMap.value( QStringLiteral( "subLayerIds" ) ).toList().empty() )
57+
{
58+
// group layer - do not show as it is not possible to load
59+
// TODO - turn model into a tree and show nested groups
60+
continue;
61+
}
62+
5663
// Get layer info
57-
QVariantMap layerData = QgsArcGisRestUtils::getLayerInfo( connection.uri().param( QStringLiteral( "url" ) ) + "/" + layerInfoMap[QStringLiteral( "id" )].toString(), errorTitle, errorMessage );
64+
const QVariantMap layerData = QgsArcGisRestUtils::getLayerInfo( connection.uri().param( QStringLiteral( "url" ) ) + "/" + layerInfoMap[QStringLiteral( "id" )].toString(), errorTitle, errorMessage );
5865
if ( layerData.isEmpty() )
5966
{
6067
layerErrors.append( tr( "Layer %1: %2 - %3" ).arg( layerInfoMap[QStringLiteral( "id" )].toString(), errorTitle, errorMessage ) );

0 commit comments

Comments
 (0)