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