Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[wcs] exclude invalid CRSs from the coverage metadata
  • Loading branch information
alexbruy committed Jan 29, 2019
1 parent 2f7550d commit 650f4d7
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/providers/wcs/qgswcscapabilities.cpp
Expand Up @@ -795,15 +795,25 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW

// requestResponseCRSs and requestCRSs + responseCRSs are alternatives
// we try to parse one or the other
coverage->supportedCrs = domElementsTexts( coverageOfferingElement, QStringLiteral( "supportedCRSs.requestResponseCRSs" ) );
if ( coverage->supportedCrs.isEmpty() )
QStringList crsList;
crsList = domElementsTexts( coverageOfferingElement, QStringLiteral( "supportedCRSs.requestResponseCRSs" ) );
if ( crsList.isEmpty() )
{
coverage->supportedCrs = domElementsTexts( coverageOfferingElement, QStringLiteral( "supportedCRSs.requestCRSs" ) );
coverage->supportedCrs << domElementsTexts( coverageOfferingElement, QStringLiteral( "supportedCRSs.responseCRSs" ) );
crsList = domElementsTexts( coverageOfferingElement, QStringLiteral( "supportedCRSs.requestCRSs" ) );
crsList << domElementsTexts( coverageOfferingElement, QStringLiteral( "supportedCRSs.responseCRSs" ) );
}

// exclude invalid CRSs from the lists
for ( const QString &crsid : crsList )
{
if ( QgsCoordinateReferenceSystem::fromOgcWmsCrs( crsid ).isValid() )
{
coverage->supportedCrs << crsid;
}
}

// TODO: requestCRSs, responseCRSs - must be then implemented also in provider
QgsDebugMsg( "supportedCrs = " + coverage->supportedCrs.join( "," ) );
//QgsDebugMsg( "supportedCrs = " + coverage->supportedCrs.join( "," ) );

coverage->nativeCrs = domElementText( coverageOfferingElement, QStringLiteral( "supportedCRSs.nativeCRSs" ) );

Expand All @@ -824,7 +834,11 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
// If supportedCRSs.nativeCRSs is not defined we try to get it from RectifiedGrid
if ( coverage->nativeCrs.isEmpty() )
{
coverage->nativeCrs = gridElement.attribute( QStringLiteral( "srsName" ) );
QString crs = gridElement.attribute( QStringLiteral( "srsName" ) );
if ( QgsCoordinateReferenceSystem::fromOgcWmsCrs( crs ).isValid() )
{
coverage->nativeCrs = crs;
}
}

if ( !gridElement.isNull() )
Expand Down

0 comments on commit 650f4d7

Please sign in to comment.