Skip to content
Permalink
Browse files
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.
  • Loading branch information
nyalldawson committed Feb 9, 2018
1 parent d229ec1 commit 9dd8136
Showing 1 changed file with 9 additions and 2 deletions.
@@ -47,14 +47,21 @@ bool QgsAfsSourceSelect::connectToService( const QgsOwsConnection &connection )
QStringList layerErrors;
foreach ( const QVariant &layerInfo, serviceInfoMap["layers"].toList() )
{
QVariantMap layerInfoMap = layerInfo.toMap();
const QVariantMap layerInfoMap = layerInfo.toMap();
if ( !layerInfoMap[QStringLiteral( "id" )].isValid() )
{
continue;
}

if ( !layerInfoMap.value( QStringLiteral( "subLayerIds" ) ).toList().empty() )
{
// group layer - do not show as it is not possible to load
// TODO - turn model into a tree and show nested groups
continue;
}

// Get layer info
QVariantMap layerData = QgsArcGisRestUtils::getLayerInfo( connection.uri().param( QStringLiteral( "url" ) ) + "/" + layerInfoMap[QStringLiteral( "id" )].toString(), errorTitle, errorMessage );
const QVariantMap layerData = QgsArcGisRestUtils::getLayerInfo( connection.uri().param( QStringLiteral( "url" ) ) + "/" + layerInfoMap[QStringLiteral( "id" )].toString(), errorTitle, errorMessage );
if ( layerData.isEmpty() )
{
layerErrors.append( tr( "Layer %1: %2 - %3" ).arg( layerInfoMap[QStringLiteral( "id" )].toString(), errorTitle, errorMessage ) );

0 comments on commit 9dd8136

Please sign in to comment.