Opened 13 years ago

Closed 13 years ago

#3966 closed defect (fixed)

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 (1)

r11972_wcs11_projection_error.patch (339 bytes ) - added by fschindler 13 years ago.
Proposed solution to the problem

Download all attachments as: .zip

Change History (5)

by fschindler, 13 years ago

Proposed solution to the problem

comment:1 by sdlime, 13 years ago

Component: MapServer C LibraryWCS Server

comment:2 by warmerdam, 13 years ago

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.

comment:3 by schpidi, 13 years ago

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?

comment:4 by schpidi, 13 years ago

Resolution: fixed
Status: newclosed

Committed check for imageCRS in r12058.

Note: See TracTickets for help on using tickets.