@@ -187,6 +187,32 @@ void QgsWcsCapabilities::clear()
187187 mCapabilities = c;
188188}
189189
190+ QString QgsWcsCapabilities::getCapabilitiesUrl ( const QString version ) const
191+ {
192+ QString url = prepareUri ( mUri .param ( " url" ) ) + " SERVICE=WCS&REQUEST=GetCapabilities" ;
193+
194+ if ( !version.isEmpty () )
195+ {
196+ // 1.0.0 - VERSION
197+ // 1.1.0 - AcceptVersions (not supported by UMN Mapserver 6.0.3 - defaults to latest 1.1
198+ if ( version.startsWith ( " 1.0" ) )
199+ {
200+ url += " &VERSION=" + version;
201+ }
202+ else if ( version.startsWith ( " 1.1" ) )
203+ {
204+ // Ignored by UMN Mapserver 6.0.3, see below
205+ url += " &AcceptVersions=" + version;
206+ }
207+ }
208+ return url;
209+ }
210+
211+ QString QgsWcsCapabilities::getCapabilitiesUrl ( ) const
212+ {
213+ return getCapabilitiesUrl ( mVersion );
214+ }
215+
190216bool QgsWcsCapabilities::retrieveServerCapabilities ( )
191217{
192218 clear ();
@@ -196,21 +222,10 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( )
196222
197223 if ( !preferredVersion.isEmpty () )
198224 {
199- // This is not
200- if ( preferredVersion.startsWith ( " 1.0" ) )
201- {
202- versions << " VERSION=" + preferredVersion;
203- }
204- else if ( preferredVersion.startsWith ( " 1.1" ) )
205- {
206- // Ignored by UMN Mapserver 6.0.3, see below
207- versions << " AcceptVersions=" + preferredVersion;
208- }
225+ versions << preferredVersion;
209226 }
210227 else
211228 {
212- // 1.0.0 - VERSION
213- // 1.1.0 - AcceptVersions (not supported by UMN Mapserver 6.0.3 - defaults to latest 1.1
214229 // We prefer 1.0 because 1.1 has many issues, each server implements it in defferent
215230 // way with various particularities
216231 // It may happen that server supports 1.1.0 but gives error for 1.1
@@ -232,12 +247,7 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( QString preferredVersion )
232247{
233248 clear ();
234249
235- QString url = prepareUri ( mUri .param ( " url" ) ) + " SERVICE=WCS&REQUEST=GetCapabilities" ;
236-
237- if ( !preferredVersion.isEmpty () )
238- {
239- url += " &" + preferredVersion;
240- }
250+ QString url = getCapabilitiesUrl ( preferredVersion );
241251
242252 if ( ! sendRequest ( url ) ) { return false ; }
243253
@@ -261,6 +271,23 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( QString preferredVersion )
261271 return true ;
262272}
263273
274+ QString QgsWcsCapabilities::getDescribeCoverageUrl ( QString const &identifier ) const
275+ {
276+ QString url = prepareUri ( mUri .param ( " url" ) ) + " SERVICE=WCS&REQUEST=DescribeCoverage&VERSION=" + mVersion ;
277+
278+ if ( mVersion .startsWith ( " 1.0" ) )
279+ {
280+ url += " &COVERAGE=" + identifier;
281+ }
282+ else if ( mVersion .startsWith ( " 1.1" ) )
283+ {
284+ // in 1.1.0, 1.1.1, 1.1.2 the name of param is 'identifier'
285+ // but in KVP 'identifiers'
286+ url += " &IDENTIFIERS=" + identifier;
287+ }
288+ return url;
289+ }
290+
264291bool QgsWcsCapabilities::describeCoverage ( QString const &identifier, bool forceRefresh )
265292{
266293 QgsDebugMsg ( " identifier = " + identifier );
@@ -274,18 +301,7 @@ bool QgsWcsCapabilities::describeCoverage( QString const &identifier, bool force
274301
275302 if ( coverage->described && ! forceRefresh ) return true ;
276303
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- }
304+ QString url = getDescribeCoverageUrl ( coverage->identifier );
289305
290306 if ( ! sendRequest ( url ) ) { return false ; }
291307
0 commit comments