@@ -794,7 +794,24 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
794
794
QDomElement supportedCRSsElement = firstChild ( coverageOfferingElement, QStringLiteral ( " supportedCRSs" ) );
795
795
796
796
// 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
+
798
815
// TODO: requestCRSs, responseCRSs - must be then implemented also in provider
799
816
// QgsDebugMsg( "supportedCrs = " + coverage->supportedCrs.join( "," ) );
800
817
@@ -817,7 +834,11 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
817
834
// If supportedCRSs.nativeCRSs is not defined we try to get it from RectifiedGrid
818
835
if ( coverage->nativeCrs .isEmpty () )
819
836
{
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
+ }
821
842
}
822
843
823
844
if ( !gridElement.isNull () )
0 commit comments