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

Function msWCSGetCoverage_ImageCRSSetup

mapwcs.c:1493–1554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1491/************************************************************************/
1492
1493static int msWCSGetCoverage_ImageCRSSetup(
1494 mapObj *map, cgiRequestObj *request, wcsParamsObj *params,
1495 coverageMetadataObj *cm, layerObj *layer )
1496
1497{
1498/* -------------------------------------------------------------------- */
1499/* Load map with the layer (coverage) coordinate system. We */
1500/* really need a set projectionObj from projectionObj function! */
1501/* -------------------------------------------------------------------- */
1502 char *layer_proj = msGetProjectionString( &(layer->projection) );
1503
1504 if (msLoadProjectionString(&(map->projection), layer_proj) != 0)
1505 return msWCSException( map, NULL, NULL, params->version );
1506
1507 free( layer_proj );
1508 layer_proj = NULL;
1509
1510/* -------------------------------------------------------------------- */
1511/* Reset bounding box. */
1512/* -------------------------------------------------------------------- */
1513 if( params->bbox.maxx != params->bbox.minx )
1514 {
1515 rectObj orig_bbox = params->bbox;
1516
1517 params->bbox.minx =
1518 cm->geotransform[0]
1519 + orig_bbox.minx * cm->geotransform[1]
1520 + orig_bbox.miny * cm->geotransform[2];
1521 params->bbox.maxy =
1522 cm->geotransform[3]
1523 + orig_bbox.minx * cm->geotransform[4]
1524 + orig_bbox.miny * cm->geotransform[5];
1525 params->bbox.maxx =
1526 cm->geotransform[0]
1527 + (orig_bbox.maxx+1) * cm->geotransform[1]
1528 + (orig_bbox.maxy+1) * cm->geotransform[2];
1529 params->bbox.miny =
1530 cm->geotransform[3]
1531 + (orig_bbox.maxx+1) * cm->geotransform[4]
1532 + (orig_bbox.maxy+1) * cm->geotransform[5];
1533
1534 /* WCS 1.1 boundbox is center of pixel oriented. */
1535 if( strncasecmp(params->version,"1.1",3) == 0 )
1536 {
1537 params->bbox.minx += cm->geotransform[1]/2 + cm->geotransform[2]/2;
1538 params->bbox.maxx -= cm->geotransform[1]/2 + cm->geotransform[2]/2;
1539 params->bbox.maxy += cm->geotransform[4]/2 + cm->geotransform[5]/2;
1540 params->bbox.miny -= cm->geotransform[4]/2 + cm->geotransform[5]/2;
1541 }
1542 }
1543
1544/* -------------------------------------------------------------------- */
1545/* Reset resolution. */
1546/* -------------------------------------------------------------------- */
1547 if( params->resx != 0.0 )
1548 {
1549 params->resx = cm->geotransform[1] * params->resx;
1550 params->resy = fabs(cm->geotransform[5] * params->resy);

Callers 1

msWCSGetCoverageFunction · 0.85

Calls 4

msGetProjectionStringFunction · 0.85
msLoadProjectionStringFunction · 0.85
msWCSExceptionFunction · 0.85
strncasecmpFunction · 0.85

Tested by

no test coverage detected