Skip to content
Permalink
Browse files

[wcs] exclude invalid CRSs from the coverage metadata

  • Loading branch information
alexbruy committed Jan 28, 2019
1 parent 2f7550d commit 650f4d780ce59dc915419b7a7eb47df5feb2bd52
Showing with 20 additions and 6 deletions.
  1. +20 −6 src/providers/wcs/qgswcscapabilities.cpp
@@ -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" ) );

@@ -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() )

0 comments on commit 650f4d7

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