Skip to content
Permalink
Browse files

[BUGFIX] WFS GetCapabilities respons misses <keywords> key

Fixes #13037 WFS GetCapabilities respons misses <keywords> key

Replace KeywordList by Keywords in WFS Getcapabilities and keywords in WCS GetCapabilities.
  • Loading branch information
rldhont committed Dec 18, 2015
1 parent 4511cc4 commit e2d1320295fa16fc40f2787531bd5d2cbda2bd29
Showing with 40 additions and 26 deletions.
  1. +40 −23 src/server/qgsserverprojectparser.cpp
  2. +0 −3 tests/testdata/qgis_server/wfs_getcapabilities.txt
@@ -418,33 +418,50 @@ void QgsServerProjectParser::serviceCapabilities( QDomElement& parentElement, QD

//keyword list
QDomElement keywordListElem = propertiesElement.firstChildElement( "WMSKeywordList" );
QDomElement wmsKeywordElem = doc.createElement( "KeywordList" );
//add default keyword
QDomElement keywordElem = doc.createElement( "Keyword" );
keywordElem.setAttribute( "vocabulary", "ISO" );
QDomText keywordText = doc.createTextNode( "infoMapAccessService" );
if ( service.compare( "WFS", Qt::CaseInsensitive ) == 0 )
keywordText = doc.createTextNode( "infoFeatureAccessService" );
else if ( service.compare( "WCS", Qt::CaseInsensitive ) == 0 )
keywordText = doc.createTextNode( "infoCoverageAccessService" );
keywordElem.appendChild( keywordText );
wmsKeywordElem.appendChild( keywordElem );
serviceElem.appendChild( wmsKeywordElem );
//add config keywords
if ( !keywordListElem.isNull() && !keywordListElem.text().isEmpty() )
{
QDomNodeList keywordList = keywordListElem.elementsByTagName( "value" );
for ( int i = 0; i < keywordList.size(); ++i )
if ( service.compare( "WMS", Qt::CaseInsensitive ) == 0 )
{
QDomElement wmsKeywordElem = doc.createElement( "KeywordList" );
//add default keyword
QDomElement keywordElem = doc.createElement( "Keyword" );
keywordElem.setAttribute( "vocabulary", "ISO" );
QDomText keywordText = doc.createTextNode( "infoMapAccessService" );
/* If WFS and WCS 2.0 is implemented
if ( service.compare( "WFS", Qt::CaseInsensitive ) == 0 )
keywordText = doc.createTextNode( "infoFeatureAccessService" );
else if ( service.compare( "WCS", Qt::CaseInsensitive ) == 0 )
keywordText = doc.createTextNode( "infoCoverageAccessService" );*/
keywordElem.appendChild( keywordText );
wmsKeywordElem.appendChild( keywordElem );
serviceElem.appendChild( wmsKeywordElem );
//add config keywords
if ( !keywordListElem.isNull() && !keywordListElem.text().isEmpty() )
{
keywordElem = doc.createElement( "Keyword" );
keywordText = doc.createTextNode( keywordList.at( i ).toElement().text() );
keywordElem.appendChild( keywordText );
if ( sia2045 )
QDomNodeList keywordList = keywordListElem.elementsByTagName( "value" );
for ( int i = 0; i < keywordList.size(); ++i )
{
keywordElem.setAttribute( "vocabulary", "SIA_Geo405" );
keywordElem = doc.createElement( "Keyword" );
keywordText = doc.createTextNode( keywordList.at( i ).toElement().text() );
keywordElem.appendChild( keywordText );
if ( sia2045 )
{
keywordElem.setAttribute( "vocabulary", "SIA_Geo405" );
}
wmsKeywordElem.appendChild( keywordElem );
}
wmsKeywordElem.appendChild( keywordElem );
}
} else if ( !keywordListElem.isNull() && !keywordListElem.text().isEmpty() ) {
QDomNodeList keywordNodeList = keywordListElem.elementsByTagName( "value" );
QStringList keywordList;
for ( int i = 0; i < keywordNodeList.size(); ++i )
{
keywordList.push_back( keywordNodeList.at( i ).toElement().text() );
}
QDomElement wmsKeywordElem = doc.createElement( "Keywords" );
if ( service.compare( "WCS", Qt::CaseInsensitive ) == 0 )
wmsKeywordElem = doc.createElement( "keywords" );
QDomText keywordText = doc.createTextNode( keywordList.join( ", " ) );
wmsKeywordElem.appendChild( keywordText );
serviceElem.appendChild( wmsKeywordElem );
}

//OnlineResource element is mandatory according to the WMS specification
@@ -6,9 +6,6 @@ Content-Type: text/xml; charset=utf-8
<Name>WFS</Name>
<Title>QGIS TestProject</Title>
<Abstract>Some UTF8 text èòù</Abstract>
<KeywordList>
<Keyword vocabulary="ISO">infoFeatureAccessService</Keyword>
</KeywordList>
<OnlineResource xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href=""/>
<Fees>conditions unknown</Fees>
<AccessConstraints>None</AccessConstraints>

0 comments on commit e2d1320

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