| 3563 | /************************************************************************/ |
| 3564 | |
| 3565 | int msWCSGetCoverage20(mapObj *map, cgiRequestObj *request, |
| 3566 | wcs20ParamsObjPtr params, owsRequestObj *ows_request) |
| 3567 | { |
| 3568 | layerObj *layer = NULL; |
| 3569 | wcs20coverageMetadataObj cm; |
| 3570 | imageObj *image = NULL; |
| 3571 | outputFormatObj *format = NULL; |
| 3572 | |
| 3573 | rectObj subsets, bbox; |
| 3574 | projectionObj imageProj; |
| 3575 | |
| 3576 | int status, i; |
| 3577 | double x_1, x_2, y_1, y_2; |
| 3578 | char *coverageName, *bandlist=NULL, numbands[8]; |
| 3579 | |
| 3580 | /* number of coverage ids should be 1 */ |
| 3581 | if (params->ids == NULL || params->ids[0] == NULL) { |
| 3582 | msSetError(MS_WCSERR, "Required parameter CoverageID was not supplied.", |
| 3583 | "msWCSGetCoverage20()"); |
| 3584 | return msWCSException(map, "MissingParameterValue", "coverage", |
| 3585 | params->version); |
| 3586 | } |
| 3587 | if (params->ids[1] != NULL) { |
| 3588 | msSetError(MS_WCSERR, "GetCoverage operation supports only one coverage.", |
| 3589 | "msWCSGetCoverage20()"); |
| 3590 | return msWCSException(map, "TooManyParameterValues", "coverage", |
| 3591 | params->version); |
| 3592 | } |
| 3593 | |
| 3594 | /* find the right layer */ |
| 3595 | layer = NULL; |
| 3596 | for(i = 0; i < map->numlayers; i++) { |
| 3597 | coverageName = msOWSGetEncodeMetadata(&(GET_LAYER(map, i)->metadata), |
| 3598 | "CO", "name", |
| 3599 | GET_LAYER(map, i)->name); |
| 3600 | if (EQUAL(coverageName, params->ids[0]) && |
| 3601 | (msIntegerInArray(GET_LAYER(map, i)->index, ows_request->enabled_layers, ows_request->numlayers))) |
| 3602 | { |
| 3603 | layer = GET_LAYER(map, i); |
| 3604 | i = map->numlayers; /* to exit loop don't use break, we want to free resources first */ |
| 3605 | } |
| 3606 | msFree(coverageName); |
| 3607 | } |
| 3608 | |
| 3609 | /* throw exception if no Layer was found */ |
| 3610 | if (layer == NULL) |
| 3611 | { |
| 3612 | msSetError(MS_WCSERR, |
| 3613 | "COVERAGE=%s not found, not in supported layer list.", |
| 3614 | "msWCSGetCoverage20()", params->ids[0]); |
| 3615 | return msWCSException(map, "InvalidParameterValue", "coverage", |
| 3616 | params->version); |
| 3617 | } |
| 3618 | /* retrieve coverage metadata */ |
| 3619 | status = msWCSGetCoverageMetadata20(layer, &cm); |
| 3620 | if (status != MS_SUCCESS) return MS_FAILURE; |
| 3621 | |
| 3622 | /* fill in bands rangeset info, if required. */ |
no test coverage detected