MCPcopy Index your code
hub / github.com/MapServer/MapServer / msWCSGetCoverageBands10

Function msWCSGetCoverageBands10

mapwcs.c:1428–1482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1426/************************************************************************/
1427
1428static int msWCSGetCoverageBands10( mapObj *map, cgiRequestObj *request,
1429 wcsParamsObj *params, layerObj *lp,
1430 char **p_bandlist )
1431
1432{
1433 const char *value = NULL;
1434 int i;
1435
1436 /* Are there any non-spatio/temporal ranges to do subsetting on (e.g. bands) */
1437 value = msOWSLookupMetadata(&(lp->metadata), "CO", "rangeset_axes"); /* this will get all the compound range sets */
1438 if(value) {
1439 char **tokens;
1440 int numtokens;
1441 char tag[100];
1442 const char *rangeitem;
1443
1444 tokens = msStringSplit(value, ',', &numtokens);
1445
1446 for(i=0; i<numtokens; i++) {
1447 if((value = msWCSGetRequestParameter(request, tokens[i])) == NULL) continue; /* next rangeset parameter */
1448
1449 /* ok, a parameter has been passed which matches a token in wcs_rangeset_axes */
1450 if(msWCSValidateRangeSetParam(lp, tokens[i], value) != MS_SUCCESS) {
1451 msSetError( MS_WCSERR, "Error specifying \"%s\" parameter value(s).", "msWCSGetCoverage()", tokens[i]);
1452 return msWCSException(map, "InvalidParameterValue", tokens[i], params->version );
1453 }
1454
1455 /* xxxxx_rangeitem tells us how to subset */
1456 snprintf(tag, sizeof(tag), "%s_rangeitem", tokens[i]);
1457 if((rangeitem = msOWSLookupMetadata(&(lp->metadata), "CO", tag)) == NULL) {
1458 msSetError( MS_WCSERR, "Missing required metadata element \"%s\", unable to process %s=%s.", "msWCSGetCoverage()", tag, tokens[i], value);
1459 return msWCSException(map, NULL, NULL, params->version);
1460 }
1461
1462 if(strcasecmp(rangeitem, "_bands") == 0) { /* special case, subset bands */
1463 *p_bandlist = msWCSConvertRangeSetToString(value);
1464
1465 if(!*p_bandlist) {
1466 msSetError( MS_WCSERR, "Error specifying \"%s\" parameter value(s).", "msWCSGetCoverage()", tokens[i]);
1467 return msWCSException(map, NULL, NULL, params->version );
1468 }
1469 } else if(strcasecmp(rangeitem, "_pixels") == 0) { /* special case, subset pixels */
1470 msSetError( MS_WCSERR, "Arbitrary range sets based on pixel values are not yet supported.", "msWCSGetCoverage()" );
1471 return msWCSException(map, NULL, NULL, params->version);
1472 } else {
1473 msSetError( MS_WCSERR, "Arbitrary range sets based on tile (i.e. image) attributes are not yet supported.", "msWCSGetCoverage()" );
1474 return msWCSException(map, NULL, NULL, params->version );
1475 }
1476 }
1477 /* clean-up */
1478 msFreeCharArray(tokens, numtokens);
1479 }
1480
1481 return MS_SUCCESS;
1482}
1483
1484/************************************************************************/
1485/* msWCSGetCoverage_ImageCRSSetup() */

Callers 1

msWCSGetCoverageFunction · 0.85

Calls 9

msOWSLookupMetadataFunction · 0.85
msStringSplitFunction · 0.85
msWCSGetRequestParameterFunction · 0.85
msSetErrorFunction · 0.85
msWCSExceptionFunction · 0.85
strcasecmpFunction · 0.85
msFreeCharArrayFunction · 0.85

Tested by

no test coverage detected