Ticket #3966 (closed defect: fixed)

Opened 23 months ago

Last modified 22 months ago

WCS 1.1: call to msOWSCommonBoundingBox sets an error

Reported by: fschindler Owned by: sdlime
Priority: normal Milestone: 6.2 release
Component: WCS Server Version: unspecified
Severity: normal Keywords: OWS WCS DescribeCoverage
Cc: warmerdam, schpidi

Description

In WCS 1.1 DescribeCoverage requests produce errors in (swig)mapscript applications (not in CGI applications). The following case reproduces the error (it should work with any input image):

MAP
  CONFIG "MS_ERRORFILE" "stderr"

  WEB
    METADATA
      "ows_onlineresource" "http://something?"
      "ows_enable_request" "*"
    END
  END 

  LAYER
    NAME "a" 
    DUMP TRUE 
    DATA "test.tif" 
    TYPE RASTER 
    METADATA
      "ows_srs" "EPSG:4326"
    END
  END
END

And this is the application python code:

import mapscript

ows_req = mapscript.OWSRequest()
ows_req.setParameter('SERVICE','WCS')
ows_req.setParameter('REQUEST','DescribeCoverage')
ows_req.setParameter('VERSION','1.1.0')
ows_req.setParameter('COVERAGE','a')

map = mapscript.mapObj('test.map')
mapscript.msIO_installStdoutToBuffer()
dispatch_status = map.OWSDispatch(ows_req)
print mapscript.msIO_getStdoutBufferBytes()

When run it results in the following error:

Traceback (most recent call last):
  File "disp.py", line 13, in <module>
    dispatch_status = map.OWSDispatch(ows_req)
_mapscript.MapServerError: msLoadProjectionString(): Projection library error. Unrecognised OGC CRS def 'urn:ogc:def:crs:OGC::imageCRS'.

This is due to an error that is set in msLoadProjection() which is never reset (like in the msWCSException function). Because the error list is not reset an exception is thrown after the OWSDispatch.

The error occurs in msWCSDescribeCoverage_CoverageDescription11 when calling msOWSCommonBoundingBox() with the parameter crs = "urn:ogc:def:crs:OGC::imageCRS".

The following patch should resolve the problem by adding a check if the given CRS containts "imageCRS":

Index: mapowscommon.c
===================================================================
--- mapowscommon.c	(revision 11972)
+++ mapowscommon.c	(working copy)
@@ -512,6 +512,7 @@
   xmlNodePtr psRootNode = NULL;
 
   /* Do we need to reorient tuple axes? */
+  if(crs && strstr(crs, "imageCRS") == NULL)
   {
       projectionObj proj;

Attachments

r11972_wcs11_projection_error.patch Download (339 bytes) - added by fschindler 23 months ago.
Proposed solution to the problem

Change History

Changed 23 months ago by fschindler

Proposed solution to the problem

Changed 23 months ago by sdlime

  • component changed from MapServer C Library to WCS Server

Changed 23 months ago by warmerdam

  • cc warmerdam, schpidi added

Steve,

Are you on this? My first impression is that we ought to be clearing the error stack at some point if we don't consider the failure important rather than special casing imageCRS but I haven't dug into it.

Changed 23 months ago by schpidi

According to me the check on imageCRS before calling msInitProjection() is valid here. If there are no objections I'd apply the patch.

However, inspecting the error stack e.g. in msOWSDispatch() and deciding on returning an error message or clearing the stack is another discussion. Does this qualify for a ticket?

Changed 22 months ago by schpidi

  • status changed from new to closed
  • resolution set to fixed

Committed check for imageCRS in r12058.

Note: See TracTickets for help on using tickets.