Skip to content

Commit

Permalink
Merge pull request #55094 from elpaso/server-describefeature-support-…
Browse files Browse the repository at this point in the history
…layer-and-layers

Server: support both LAYER and LAYERS for describelayer
  • Loading branch information
elpaso authored Nov 10, 2023
2 parents 8efd735 + aef4835 commit 5486c41
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/server/services/wms/qgswmsdescribelayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,32 @@ namespace QgsWms
QStringLiteral( "SLD_VERSION = %1 is not supported" ).arg( parameters[ QStringLiteral( "SLD_VERSION" )] ), 400 );
}

if ( !parameters.contains( QStringLiteral( "LAYERS" ) ) )
if ( !parameters.contains( QStringLiteral( "LAYERS" ) ) && !parameters.contains( QStringLiteral( "LAYER" ) ) )
{
throw QgsServiceException( QStringLiteral( "MissingParameterValue" ),
QStringLiteral( "LAYERS is mandatory for DescribeLayer operation" ), 400 );
QStringLiteral( "LAYERS or LAYER is mandatory for DescribeLayer operation" ), 400 );
}

QStringList layersList;

#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList layersList = parameters[ QStringLiteral( "LAYERS" )].split( ',', QString::SkipEmptyParts );
if ( parameters.contains( QStringLiteral( "LAYERS" ) ) )
{
layersList = parameters[ QStringLiteral( "LAYERS" )].split( ',', QString::SkipEmptyParts );
}
else
{
layersList = parameters[ QStringLiteral( "LAYER" )].split( ',', QString::SkipEmptyParts );
}
#else
const QStringList layersList = parameters[ QStringLiteral( "LAYERS" )].split( ',', Qt::SkipEmptyParts );
if ( parameters.contains( QStringLiteral( "LAYERS" ) ) )
{
layersList = parameters[ QStringLiteral( "LAYERS" )].split( ',', Qt::SkipEmptyParts );
}
else
{
layersList = parameters[ QStringLiteral( "LAYER" )].split( ',', Qt::SkipEmptyParts );
}
#endif
if ( layersList.isEmpty() )
{
Expand Down

0 comments on commit 5486c41

Please sign in to comment.