Skip to content

Commit 7aca6af

Browse files
authoredFeb 5, 2019
Merge pull request #9098 from alexbruy/wcs-backport
Wcs backport
2 parents 526a6b6 + 9a5143d commit 7aca6af

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed
 

‎src/providers/wcs/qgswcscapabilities.cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,24 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
790790
QDomElement supportedCRSsElement = firstChild( coverageOfferingElement, QStringLiteral( "supportedCRSs" ) );
791791

792792
// 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+
794811
// TODO: requestCRSs, responseCRSs - must be then implemented also in provider
795812
//QgsDebugMsg( "supportedCrs = " + coverage->supportedCrs.join( "," ) );
796813

@@ -813,7 +830,11 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
813830
// If supportedCRSs.nativeCRSs is not defined we try to get it from RectifiedGrid
814831
if ( coverage->nativeCrs.isEmpty() )
815832
{
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+
}
817838
}
818839

819840
if ( !gridElement.isNull() )

‎src/providers/wcs/qgswcssourceselect.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ QStringList QgsWCSSourceSelect::selectedLayersFormats()
226226

227227
QStringList QgsWCSSourceSelect::selectedLayersCrses()
228228
{
229-
230229
QString identifier = selectedIdentifier();
231230
if ( identifier.isEmpty() ) { return QStringList(); }
232231

0 commit comments

Comments
 (0)
Please sign in to comment.