Skip to content
Permalink
Browse files

Improves QGIS Server WMS GetCapabilities output

Fixes #40736
  • Loading branch information
pathmapper authored and nyalldawson committed Jan 4, 2021
1 parent 8b00a0c commit 118ba4d31c39308183470afb0a35f365ff72053a
Showing with 25 additions and 8 deletions.
  1. +25 −8 src/server/services/wms/qgswmsgetcapabilities.cpp
@@ -846,17 +846,34 @@ namespace QgsWms
layerParentElem.appendChild( layerParentNameElem );
}

if ( !project->title().isEmpty() )
// Root Layer title
QDomText layerParentTitleText;
QString rootLayerTitle = QgsServerProjectUtils::owsServiceTitle( *project );
QDomElement layerParentTitleElem = doc.createElement( QStringLiteral( "Title" ) );
if ( !rootLayerTitle.isEmpty() )
{
// Root Layer title
QDomElement layerParentTitleElem = doc.createElement( QStringLiteral( "Title" ) );
QDomText layerParentTitleText = doc.createTextNode( project->title() );
layerParentTitleElem.appendChild( layerParentTitleText );
layerParentElem.appendChild( layerParentTitleElem );
layerParentTitleText = doc.createTextNode( rootLayerTitle );
}
else
{
if ( !project->title().isEmpty() )
{
layerParentTitleText = doc.createTextNode( project->title() );
}
else
{
layerParentTitleText = doc.createTextNode( QStringLiteral( "untitled" ) );
}
}
layerParentTitleElem.appendChild( layerParentTitleText );
layerParentElem.appendChild( layerParentTitleElem );

// Root Layer abstract
// Root Layer abstract
QString rootLayerAbstract = QgsServerProjectUtils::owsServiceAbstract( *project );
if ( !rootLayerAbstract.isEmpty() )
{
QDomElement layerParentAbstElem = doc.createElement( QStringLiteral( "Abstract" ) );
QDomText layerParentAbstText = doc.createTextNode( project->title() );
QDomText layerParentAbstText = doc.createTextNode( rootLayerAbstract );
layerParentAbstElem.appendChild( layerParentAbstText );
layerParentElem.appendChild( layerParentAbstElem );
}

0 comments on commit 118ba4d

Please sign in to comment.
You can’t perform that action at this time.