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

Function msWCSDescribeCoverage20

mapwcs20.c:3307–3365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3305/************************************************************************/
3306
3307int msWCSDescribeCoverage20(mapObj *map, wcs20ParamsObjPtr params, owsRequestObj *ows_request)
3308{
3309 xmlDocPtr psDoc = NULL; /* document pointer */
3310 xmlNodePtr psRootNode;
3311 xmlNsPtr psWcsNs = NULL;
3312 int i, j;
3313
3314 /* create DOM document and root node */
3315 psDoc = xmlNewDoc(BAD_CAST "1.0");
3316 psRootNode = xmlNewNode(NULL, BAD_CAST "CoverageDescriptions");
3317 xmlDocSetRootElement(psDoc, psRootNode);
3318
3319 /* prepare initial namespace definitions */
3320 msWCSPrepareNamespaces20(psDoc, psRootNode, map);
3321
3322 psWcsNs = xmlSearchNs(psDoc, psRootNode,
3323 BAD_CAST MS_OWSCOMMON_WCS_NAMESPACE_PREFIX);
3324 xmlSetNs(psRootNode, psWcsNs);
3325
3326 /* check if IDs are given */
3327 if (params->ids)
3328 {
3329 /* for each given ID in the ID-list */
3330 for (j = 0; params->ids[j]; j++)
3331 {
3332 i = msGetLayerIndex(map, params->ids[j]);
3333 if (i == -1 || (!msIntegerInArray(GET_LAYER(map, i)->index, ows_request->enabled_layers, ows_request->numlayers)) )
3334 {
3335 msSetError(MS_WCSERR, "Unknown coverage: (%s)",
3336 "msWCSDescribeCoverage20()", params->ids[j]);
3337 return msWCSException(map, "NoSuchCoverage", "coverage",
3338 params->version);
3339 }
3340 /* create coverage description for the specified layer */
3341 if(msWCSDescribeCoverage20_CoverageDescription(map, (GET_LAYER(map, i)),
3342 params, psDoc, psRootNode) == MS_FAILURE)
3343 {
3344 msSetError(MS_WCSERR, "Error retrieving coverage description.", "msWCSDescribeCoverage20()");
3345 return msWCSException(map, "MissingParameterValue", "coverage",
3346 params->version);
3347 }
3348 }
3349 }
3350 else
3351 { /* Throw error, since IDs are mandatory */
3352 msSetError(MS_WCSERR, "Missing COVERAGEID parameter.", "msWCSDescribeCoverage20()");
3353 return msWCSException(map, "MissingParameterValue", "coverage",
3354 params->version);
3355 }
3356
3357 /* write out the DOM document to the stream */
3358 msWCSWriteDocument20(map, psDoc);
3359
3360 /* cleanup */
3361 xmlFreeDoc(psDoc);
3362 xmlCleanupParser();
3363
3364 return MS_SUCCESS;

Callers 1

msWCSDispatch20Function · 0.85

Calls 7

msWCSPrepareNamespaces20Function · 0.85
msGetLayerIndexFunction · 0.85
msIntegerInArrayFunction · 0.85
msSetErrorFunction · 0.85
msWCSExceptionFunction · 0.85
msWCSWriteDocument20Function · 0.85

Tested by

no test coverage detected