@@ -211,7 +211,10 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( )
211
211
{
212
212
// 1.0.0 - VERSION
213
213
// 1.1.0 - AcceptVersions (not supported by UMN Mapserver 6.0.3 - defaults to latest 1.1
214
- versions << " AcceptVersions=1.1,1.0" << " VERSION=1.0" ;
214
+ // We prefer 1.0 because 1.1 has many issues, each server implements it in defferent
215
+ // way with various particularities
216
+ // It may happen that server supports 1.1.0 but gives error for 1.1
217
+ versions << " VERSION=1.0.0" << " AcceptVersions=1.1.0,1.0.0" ;
215
218
}
216
219
217
220
foreach ( QString v, versions )
@@ -271,8 +274,18 @@ bool QgsWcsCapabilities::describeCoverage( QString const &identifier, bool force
271
274
272
275
if ( coverage->described && ! forceRefresh ) return true ;
273
276
274
- QString url = prepareUri ( mUri .param ( " url" ) ) + " SERVICE=WCS&REQUEST=DescribeCoverage&COVERAGE=" + coverage->identifier ;
275
- url += " &VERSION=" + mVersion ;
277
+ QString url = prepareUri ( mUri .param ( " url" ) ) + " SERVICE=WCS&REQUEST=DescribeCoverage&VERSION=" + mVersion ;
278
+
279
+ if ( mVersion .startsWith ( " 1.0" ) )
280
+ {
281
+ url += " &COVERAGE=" + coverage->identifier ;
282
+ }
283
+ else if ( mVersion .startsWith ( " 1.1" ) )
284
+ {
285
+ // in 1.1.0, 1.1.1, 1.1.2 the name of param is 'identifier'
286
+ // but in KVP 'identifiers'
287
+ url += " &IDENTIFIERS=" + coverage->identifier ;
288
+ }
276
289
277
290
if ( ! sendRequest ( url ) ) { return false ; }
278
291
@@ -384,12 +397,21 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
384
397
tagName != " Capabilities" // 1.1, tags seen: Capabilities, wcs:Capabilities
385
398
)
386
399
{
387
- mErrorTitle = tr ( " Dom Exception" );
388
- mErrorFormat = " text/plain" ;
389
- mError = tr ( " Could not get WCS capabilities in the expected format (DTD): no %1 found.\n This might be due to an incorrect WCS Server URL.\n Tag:%3\n Response was:\n %4" )
390
- .arg ( " Capabilities" )
391
- .arg ( docElem.tagName () )
392
- .arg ( QString ( xml ) );
400
+ if ( tagName == " ExceptionReport" )
401
+ {
402
+ mErrorTitle = tr ( " Exception" );
403
+ mErrorFormat = " text/plain" ;
404
+ mError = tr ( " Could not get WCS capabilities: %1" ).arg ( domElementText ( docElem, " Exception.ExceptionText" ) );
405
+ }
406
+ else
407
+ {
408
+ mErrorTitle = tr ( " Dom Exception" );
409
+ mErrorFormat = " text/plain" ;
410
+ mError = tr ( " Could not get WCS capabilities in the expected format (DTD): no %1 found.\n This might be due to an incorrect WCS Server URL.\n Tag:%3\n Response was:\n %4" )
411
+ .arg ( " Capabilities" )
412
+ .arg ( docElem.tagName () )
413
+ .arg ( QString ( xml ) );
414
+ }
393
415
394
416
QgsLogger::debug ( " Dom Exception: " + mError );
395
417
@@ -570,7 +592,7 @@ QList<double> QgsWcsCapabilities::parseDoubles( const QString &text )
570
592
571
593
QString QgsWcsCapabilities::crsUrnToAuthId ( const QString &text )
572
594
{
573
- QString authid;
595
+ QString authid = text; // may be also non URN, for example 'EPSG:4326'
574
596
575
597
// URN format: urn:ogc:def:objectType:authority:version:code
576
598
// URN example: urn:ogc:def:crs:EPSG::4326
@@ -926,6 +948,25 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom11( QByteArray const &xml, QgsW
926
948
}
927
949
}
928
950
951
+ QStringList formats = domElementsTexts ( docElem, " CoverageDescription.SupportedFormat" );
952
+ // There could be formats from GetCapabilities
953
+ if ( formats.size () > 0 )
954
+ {
955
+ coverage->supportedFormat = formats;
956
+ }
957
+
958
+
959
+ QStringList crss = domElementsTexts ( docElem, " CoverageDescription.SupportedCRS" );
960
+ QSet<QString> authids; // Set, in case one CRS is in more formats (URN, non URN)
961
+ foreach ( QString crs, crss )
962
+ {
963
+ authids.insert ( crsUrnToAuthId ( crs ) );
964
+ }
965
+ if ( authids.size () > 0 )
966
+ {
967
+ coverage->supportedCrs = authids.toList ();
968
+ }
969
+
929
970
coverage->described = true ;
930
971
931
972
return true ;
@@ -952,6 +993,7 @@ void QgsWcsCapabilities::parseCoverageSummary( QDomElement const & e, QgsWcsCove
952
993
if ( tagName == " SupportedFormat" )
953
994
{
954
995
// image/tiff, ...
996
+ // Formats may be here (UMN Mapserver) or may not (GeoServer)
955
997
coverageSummary.supportedFormat << el.text ();
956
998
}
957
999
else if ( tagName == " SupportedCRS" )
0 commit comments