@@ -187,6 +187,32 @@ void QgsWcsCapabilities::clear()
187
187
mCapabilities = c;
188
188
}
189
189
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
+
190
216
bool QgsWcsCapabilities::retrieveServerCapabilities ( )
191
217
{
192
218
clear ();
@@ -196,21 +222,10 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( )
196
222
197
223
if ( !preferredVersion.isEmpty () )
198
224
{
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;
209
226
}
210
227
else
211
228
{
212
- // 1.0.0 - VERSION
213
- // 1.1.0 - AcceptVersions (not supported by UMN Mapserver 6.0.3 - defaults to latest 1.1
214
229
// We prefer 1.0 because 1.1 has many issues, each server implements it in defferent
215
230
// way with various particularities
216
231
// It may happen that server supports 1.1.0 but gives error for 1.1
@@ -232,12 +247,7 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( QString preferredVersion )
232
247
{
233
248
clear ();
234
249
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 );
241
251
242
252
if ( ! sendRequest ( url ) ) { return false ; }
243
253
@@ -261,6 +271,23 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( QString preferredVersion )
261
271
return true ;
262
272
}
263
273
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
+
264
291
bool QgsWcsCapabilities::describeCoverage ( QString const &identifier, bool forceRefresh )
265
292
{
266
293
QgsDebugMsg ( " identifier = " + identifier );
@@ -274,18 +301,7 @@ bool QgsWcsCapabilities::describeCoverage( QString const &identifier, bool force
274
301
275
302
if ( coverage->described && ! forceRefresh ) return true ;
276
303
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 );
289
305
290
306
if ( ! sendRequest ( url ) ) { return false ; }
291
307
0 commit comments