@@ -794,7 +794,24 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
794794 QDomElement supportedCRSsElement = firstChild ( coverageOfferingElement, QStringLiteral ( " supportedCRSs" ) );
795795
796796 // requestResponseCRSs and requestCRSs + responseCRSs are alternatives
797- coverage->supportedCrs = domElementsTexts ( coverageOfferingElement, QStringLiteral ( " supportedCRSs.requestResponseCRSs" ) );
797+ // we try to parse one or the other
798+ QStringList crsList;
799+ crsList = domElementsTexts ( coverageOfferingElement, QStringLiteral ( " supportedCRSs.requestResponseCRSs" ) );
800+ if ( crsList.isEmpty () )
801+ {
802+ crsList = domElementsTexts ( coverageOfferingElement, QStringLiteral ( " supportedCRSs.requestCRSs" ) );
803+ crsList << domElementsTexts ( coverageOfferingElement, QStringLiteral ( " supportedCRSs.responseCRSs" ) );
804+ }
805+
806+ // exclude invalid CRSs from the lists
807+ for ( const QString &crsid : qgis::as_const ( crsList ) )
808+ {
809+ if ( QgsCoordinateReferenceSystem::fromOgcWmsCrs ( crsid ).isValid () )
810+ {
811+ coverage->supportedCrs << crsid;
812+ }
813+ }
814+
798815 // TODO: requestCRSs, responseCRSs - must be then implemented also in provider
799816 // QgsDebugMsg( "supportedCrs = " + coverage->supportedCrs.join( "," ) );
800817
@@ -817,7 +834,11 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
817834 // If supportedCRSs.nativeCRSs is not defined we try to get it from RectifiedGrid
818835 if ( coverage->nativeCrs .isEmpty () )
819836 {
820- coverage->nativeCrs = gridElement.attribute ( QStringLiteral ( " srsName" ) );
837+ QString crs = gridElement.attribute ( QStringLiteral ( " srsName" ) );
838+ if ( QgsCoordinateReferenceSystem::fromOgcWmsCrs ( crs ).isValid () )
839+ {
840+ coverage->nativeCrs = crs;
841+ }
821842 }
822843
823844 if ( !gridElement.isNull () )
0 commit comments