| 1329 | /************************************************************************/ |
| 1330 | |
| 1331 | static int msWCSDescribeCoverage(mapObj *map, wcsParamsObj *params, owsRequestObj *ows_request) |
| 1332 | { |
| 1333 | int i = 0,j = 0, k = 0; |
| 1334 | const char *updatesequence=NULL; |
| 1335 | char **coverages=NULL; |
| 1336 | int numcoverages=0; |
| 1337 | const char *encoding; |
| 1338 | |
| 1339 | char *coverageName=NULL; |
| 1340 | |
| 1341 | encoding = msOWSLookupMetadata(&(map->web.metadata), "CO", "encoding"); |
| 1342 | /* -------------------------------------------------------------------- */ |
| 1343 | /* 1.1.x is sufficiently different we have a whole case for */ |
| 1344 | /* it. The remainder of this function is for 1.0.0. */ |
| 1345 | /* -------------------------------------------------------------------- */ |
| 1346 | if( strncmp(params->version,"1.1",3) == 0 ) |
| 1347 | return msWCSDescribeCoverage11( map, params, ows_request); |
| 1348 | |
| 1349 | /* -------------------------------------------------------------------- */ |
| 1350 | /* Process 1.0.0... */ |
| 1351 | /* -------------------------------------------------------------------- */ |
| 1352 | |
| 1353 | if(params->coverages) { /* use the list, but validate it first */ |
| 1354 | for(j=0; params->coverages[j]; j++) { |
| 1355 | coverages = msStringSplit(params->coverages[j], ',', &numcoverages); |
| 1356 | for(k=0; k<numcoverages; k++) { |
| 1357 | |
| 1358 | for(i=0; i<map->numlayers; i++) { |
| 1359 | coverageName = msOWSGetEncodeMetadata(&(GET_LAYER(map, i)->metadata), "CO", "name", GET_LAYER(map, i)->name); |
| 1360 | if( EQUAL(coverageName, coverages[k]) && |
| 1361 | (msIntegerInArray(GET_LAYER(map, i)->index, ows_request->enabled_layers, ows_request->numlayers)) ) |
| 1362 | break; |
| 1363 | } |
| 1364 | |
| 1365 | /* i = msGetLayerIndex(map, coverages[k]); */ |
| 1366 | if(i == map->numlayers) { /* coverage not found */ |
| 1367 | msSetError( MS_WCSERR, "COVERAGE %s cannot be opened / does not exist", "msWCSDescribeCoverage()", coverages[k]); |
| 1368 | return msWCSException(map, "CoverageNotDefined", "coverage", params->version ); |
| 1369 | } |
| 1370 | } /* next coverage */ |
| 1371 | } |
| 1372 | } |
| 1373 | |
| 1374 | updatesequence = msOWSLookupMetadata(&(map->web.metadata), "CO", "updatesequence"); |
| 1375 | if (!updatesequence) |
| 1376 | updatesequence = msStrdup("0"); |
| 1377 | |
| 1378 | /* printf("Content-type: application/vnd.ogc.se_xml%c%c",10,10); */ |
| 1379 | if (encoding) |
| 1380 | msIO_printf("Content-type: text/xml; charset=%s%c%c", encoding,10,10); |
| 1381 | else |
| 1382 | msIO_printf("Content-type: text/xml%c%c",10,10); |
| 1383 | |
| 1384 | /* print common capability elements */ |
| 1385 | msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), NULL, "wcs_encoding", OWS_NOERR, "<?xml version='1.0' encoding=\"%s\" ?>\n", "ISO-8859-1"); |
| 1386 | |
| 1387 | /* start the DescribeCoverage section */ |
| 1388 | msIO_printf("<CoverageDescription\n" |
no test coverage detected