mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
[arcgisrest] Fix root of a mapserver not recognized as layer
This commit is contained in:
parent
cd5e9a9adc
commit
718f21e807
@ -194,10 +194,11 @@ QgsAmsProvider::QgsAmsProvider( const QString &uri, const ProviderOptions &optio
|
||||
mServiceInfo = QgsArcGisRestUtils::getServiceInfo( serviceUrl, authcfg, mErrorTitle, mError, mRequestHeaders );
|
||||
|
||||
QString layerUrl;
|
||||
if ( mServiceInfo.value( QStringLiteral( "serviceDataType" ) ).toString().startsWith( QLatin1String( "esriImageService" ) ) )
|
||||
if ( dataSource.param( QStringLiteral( "layer" ) ).isEmpty() )
|
||||
{
|
||||
layerUrl = serviceUrl;
|
||||
mLayerInfo = mServiceInfo;
|
||||
if ( mServiceInfo.value( QStringLiteral( "serviceDataType" ) ).toString().startsWith( QLatin1String( "esriImageService" ) ) )
|
||||
mImageServer = true;
|
||||
}
|
||||
else
|
||||
@ -206,7 +207,15 @@ QgsAmsProvider::QgsAmsProvider( const QString &uri, const ProviderOptions &optio
|
||||
mLayerInfo = QgsArcGisRestUtils::getLayerInfo( layerUrl, authcfg, mErrorTitle, mError, mRequestHeaders );
|
||||
}
|
||||
|
||||
const QVariantMap extentData = mLayerInfo.value( QStringLiteral( "extent" ) ).toMap();
|
||||
QVariantMap extentData;
|
||||
if ( mLayerInfo.contains( QStringLiteral( "extent" ) ) )
|
||||
{
|
||||
extentData = mLayerInfo.value( QStringLiteral( "extent" ) ).toMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
extentData = mLayerInfo.value( QStringLiteral( "fullExtent" ) ).toMap();
|
||||
}
|
||||
mExtent.setXMinimum( extentData[QStringLiteral( "xmin" )].toDouble() );
|
||||
mExtent.setYMinimum( extentData[QStringLiteral( "ymin" )].toDouble() );
|
||||
mExtent.setXMaximum( extentData[QStringLiteral( "xmax" )].toDouble() );
|
||||
|
@ -1381,6 +1381,15 @@ void QgsArcGisRestUtils::addLayerItems( const std::function< void( const QString
|
||||
}
|
||||
}
|
||||
|
||||
// Add root MapServer as layer
|
||||
if ( serviceData.contains( QStringLiteral( "supportedImageFormatTypes" ) ) )
|
||||
{
|
||||
const QString name = QStringLiteral( "(%1)" ).arg( QObject::tr( "All layers" ) );
|
||||
const QString description = serviceData.value( QStringLiteral( "Comments" ) ).toString();
|
||||
visitor( 0, 0, name, description, parentUrl, false, authid, format );
|
||||
}
|
||||
|
||||
// Add root ImageServer as layer
|
||||
if ( serviceData.value( QStringLiteral( "serviceDataType" ) ).toString().startsWith( QLatin1String( "esriImageService" ) ) )
|
||||
{
|
||||
const QString name = serviceData.value( QStringLiteral( "name" ) ).toString();
|
||||
|
Loading…
x
Reference in New Issue
Block a user