Support of WCS 2.0 Protocol #3595

Closed
mapserver-bot opened this Issue Apr 3, 2012 · 50 comments

Comments

Projects
None yet
2 participants

Reporter: Schpidi
Date: 2010/11/01 - 14:16
Trac URL: http://trac.osgeo.org/mapserver/ticket/3595
Some days ago the new [http://www.opengeospatial.org/standards/wcs Web Coverage Service (WCS) 2.0 Interface Standard] was published on the public OGC webpages. This specification adopts the new OGC Core and Extension model and at the moment the following documents are available:

  • [http://portal.opengeospatial.org/files/?artifact_id=41437 WCS 2.0 Core]
  • [http://portal.opengeospatial.org/files/?artifact_id=41439 WCS 2.0 KVP Protocol Binding Extension]
  • [http://portal.opengeospatial.org/files/?artifact_id=41440 WCS 2.0 XML/POST Protocol Binding Extension]
  • [http://portal.opengeospatial.org/files/?artifact_id=41441 WCS 2.0 XML/SOAP Protocol Binding Extension]

Technical changes from WCS version 1.1.2 include entirely building on the [http://portal.opengeospatial.org/files/?artifact_id=41438 GML 3.2 encoding of coverages].

WCS 2.0 is based on OWS Common 2.0 and as the WCS 1.1 implementation takes advantage of the OWS metadata services in mapowscommon.c. However, because of main technical changes like the adoption of GML 3.2.1 or the introduction of trim and slice concepts the implementation is largely separated in mapwcs20.c.

At the top of msWCSDispatch() in mapwcs.c we added a junction to WCS 2.0 using msWCSDispatch20() in mapwcs20.c which parses the request independently because of the heavily changed request structure. These changes are mainly due to the new trim and slice concepts and the adoption of OWS 2.0.

Please find below some sample request to show the new functionality and usage of KVP parameters:

# GetCapabilities
http://www.yourserver.com/wcs?SERVICE=wcs&VERSION=2.0.0&REQUEST=GetCapabilities
# DescribeCoverage 2.0
http://www.yourserver.com/wcs?SERVICE=wcs&VERSION=2.0.0&REQUEST=DescribeCoverage&COVERAGEID=grey
# GetCoverage 2.0 image/tiff full
http://www.yourserver.com/wcs?SERVICE=wcs&VERSION=2.0.0&REQUEST=GetCoverage&COVERAGEID=grey&FORMAT=image/tiff
# GetCoverage 2.0 multipart/mixed (GML header & image/tiff) full
http://www.yourserver.com/wcs?SERVICE=wcs&VERSION=2.0.0&REQUEST=GetCoverage&COVERAGEID=grey&FORMAT=image/tiff&MEDIATYPE=multipart/mixed
# GetCoverage 2.0 image/tiff trim x y both
http://www.yourserver.com/wcs?SERVICE=wcs&VERSION=2.0.0&REQUEST=GetCoverage&COVERAGEID=grey&FORMAT=image/tiff&SUBSET=x(10,200)&SUBSET=y(10,200)
# GetCoverage 2.0 reproject to EPSG 4326
http://www.yourserver.com/wcs?SERVICE=wcs&VERSION=2.0.0&REQUEST=GetCoverage&COVERAGEID=grey&FORMAT=image/tiff&SUBSET=x,http://www.opengis.net/def/crs/EPSG/0/4326(-121.488744,-121.485169)

Unfortunately the schemas are not yet available at http://schemas.opengis.net/wcs/ but I've attached the latest draft version here. (Btw. if you want to use libxml2 for validation be aware that there is a bug that breaks the validation of GML 3.2.1.)

Attached are patches both for the latest stable release 5.6.5 and the current (as of writing) trunk (17f11fc (r10696)). I'll also provide patches for msautotest hopefully soon.

Have fun and many thanks for any feedback,[[BR]]
Stephan

Author: sdlime
Date: 2010/11/08 - 14:50
Patching 5.6 isn't really an option since we don't like to introduce largish features mid-release. I'd vote for patching trunk asap to start testing. - Steve

Author: warmerdam
Date: 2010/11/08 - 15:03
Steve,

I agree. Do you have time to merge this or would you like me to? I think I wrote an RFC for WCS 1.1, but I don't see that as strictly necessary unless there are significant impacts beyond adding the new WCS version. The pattern is already in place.

Author: sdlime
Date: 2010/11/08 - 17:46
I agree, these follow the established pattern so no RFC is necessary. Changes also seem to be pretty localized. I can apply the patches, I'd rather you take time to look at RFC 64... ;-)

Steve

Author: sdlime
Date: 2010/11/09 - 15:19
Applied patch in trunk and committed in addb684 (r10713). I tested compiling with and without WCS support without issue (on Linux). I've not tested the WCS server itself though.

I guess I'd like to move this ticket on to the msautotest or documentation components, with functional issues being handled via new tickets under the WCS component.

Any preference?

Steve

Author: Schpidi
Date: 2010/11/09 - 17:44
Hi Steve,

many thanks for your positive response.

We're currently working on a patch for msautotest. I've attached a first preliminary version. This patch includes an extension for msautotest to support also POST request. Please note that this is work in progress and not finished yet.

Best regards,
Stephan

Author: rouault
Date: 2010/11/09 - 23:20
There are a bunch of warnings reported by the compiler :

mapwcs20.c: In function ‘msWCSCommon20_CreateRangeType’:
mapwcs20.c:1212: warning: unused variable ‘bandNames’
mapwcs20.c: In function ‘msWCSWriteFile20’:
mapwcs20.c:1395: warning: unused variable ‘encoding’
mapwcs20.c: In function ‘msWCSGetCapabilities20_CreateProfiles’:
mapwcs20.c:1831: warning: no return statement in function returning non-void
mapwcs20.c: In function ‘msWCSGetCapabilities20’:
mapwcs20.c:1887: warning: unused variable ‘ows_version’
mapwcs20.c:1885: warning: unused variable ‘context’
mapwcs20.c:1884: warning: unused variable ‘size’
mapwcs20.c:1883: warning: unused variable ‘buffer’
mapwcs20.c:1876: warning: unused variable ‘encoding’

Author: Schpidi
Date: 2010/11/10 - 12:08
Thanks for your report. We'll have a look at the warnings and create a new patch.

Stephan

Author: Schpidi
Date: 2010/11/10 - 12:12
The schemas are now available in the official OGC schema repository:

  • WCS 2.0: [http://schemas.opengis.net/wcs/2.0/]
  • GMLCOV 1.0: [http://schemas.opengis.net/gmlcov/1.0/]

Stephan

Author: Schpidi
Date: 2010/11/10 - 22:01
I've added a patch against the current trunk that should remove the warnings.

The patch additionally includes some bug fixes.

Stephan

Author: sdlime
Date: 2010/11/11 - 05:26
I tried the patch locally but get a bunch of errors when compiling without WCS enabled.

sdlime$ make mapwcs20.o
gcc -c -O2 -fPIC -Wall     -DHAVE_VSNPRINTF -DNEED_STRRSTR                  -DUSE_WMS_SVR    -DUSE_POSTGIS -DPOSTGIS_HAS_SERVER_VERSION -DUSE_GDAL  -DUSE_GEOS   -DUSE_PROJ -DUSE_RGBA_PNG -DUSE_AGG      -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_FTEX_XSHOW -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS -DGD_HAS_GET_TRUE_COLOR_PIXEL -DUSE_ICONV -DUSE_ZLIB    -I/usr/X11/include -I/usr/local/include -I/sw/include/freetype2 -I/sw/include -Irenderers/agg/include     -I/sw/include   -I/usr/local/include -I/sw/include/postgresql     -I/usr/local/include       mapwcs20.c -o mapwcs20.o
mapwcs20.c:36:25: error: libxml/tree.h: No such file or directory
mapwcs20.c:43:27: error: libxml/parser.h: No such file or directory
mapwcs20.c: In function ‘msWCSParseRequest20’:
mapwcs20.c:415: error: ‘xmlDocPtr’ undeclared (first use in this function)
mapwcs20.c:415: error: (Each undeclared identifier is reported only once
mapwcs20.c:415: error: for each function it appears in.)
mapwcs20.c:415: error: syntax error before ‘doc’
and so on...

Enabling WCS (--with-wcs) is more successful. Actually addb684 (r10713) gives me the same problems on my home mac. So, I've committed the patch to trunk (96bb945 (r10714)).

Steve

Author: Schpidi
Date: 2010/11/11 - 12:45
You're right. To be honest I didn't try to compile without WCS support. I think the errors are because of the also missing libxml2 support. The attached patch includes a quick fix for that (but includes also a TODO).

Stephan

Author: tamas
Date: 2010/11/12 - 17:05
The changes were applied in 96bb945 (r10714) and it's now breaking the compilation with MSVC, causing the following errors:

mapwcs20.c
mapwcs20.c(769) : error C2057: expected constant expression
mapwcs20.c(769) : error C2466: cannot allocate an array of constant size 0
mapwcs20.c(769) : error C2133: 'subsets' : unknown size
mapwcs20.c(1125) : warning C4018: '<' : signed/unsigned mismatch
mapwcs20.c(1158) : error C2143: syntax error : missing ';' before 'type'
mapwcs20.c(1168) : error C2065: 'interval' : undeclared identifier
mapwcs20.c(1168) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
mapwcs20.c(1168) : warning C4024: 'sprintf' : different types for formal and actual parameter 1
mapwcs20.c(1171) : error C2065: 'interval' : undeclared identifier
mapwcs20.c(1171) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
mapwcs20.c(1171) : warning C4024: 'sprintf' : different types for formal and actual parameter 1
mapwcs20.c(1174) : error C2065: 'interval' : undeclared identifier
mapwcs20.c(1174) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
mapwcs20.c(1174) : warning C4024: 'sprintf' : different types for formal and actual parameter 1
mapwcs20.c(1177) : error C2065: 'interval' : undeclared identifier
mapwcs20.c(1769) : warning C4018: '<' : signed/unsigned mismatch
mapwcs20.c(1777) : warning C4018: '<' : signed/unsigned mismatch
mapwcs20.c(1850) : warning C4018: '<' : signed/unsigned mismatch
mapwcs20.c(1883) : warning C4018: '<' : signed/unsigned mismatch
mapwcs20.c(1891) : warning C4018: '<' : signed/unsigned mismatch
mapwcs20.c(2012) : error C2057: expected constant expression
mapwcs20.c(2012) : error C2466: cannot allocate an array of constant size 0
mapwcs20.c(2012) : error C2133: 'available_mime_types' : unknown size
mapwcs20.c(2683) : warning C4013: 'lround' undefined; assuming extern returning int
mapwcs20.c(2738) : warning C4018: '<' : signed/unsigned mismatch
mapwcs20.c(2920) : error C2143: syntax error : missing ';' before 'type'
mapwcs20.c(2924) : error C2065: 'x' : undeclared identifier
mapwcs20.c(2924) : error C2065: 'x' : undeclared identifier
mapwcs20.c(2924) : error C2065: 'x' : undeclared identifier
mapwcs20.c(2925) : error C2065: 'x' : undeclared identifier
mapwcs20.c(2929) : error C2065: 'x' : undeclared identifier
mapwcs20.c(2929) : error C2065: 'x' : undeclared identifier
mapwcs20.c(2929) : error C2065: 'x' : undeclared identifier
mapwcs20.c(2931) : error C2065: 'x' : undeclared identifier
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

Is this something to be compiled as C++ code?

Author: sdlime
Date: 2010/11/12 - 17:07
Replying to [comment:13 Schpidi]:

Patch applied in 0b99831 (r10717)...

Author: tamas
Date: 2010/11/14 - 20:56
Replying to [comment:14 tamas]:

I've fixed the issues in 98ad545 (r10729)

Author: Schpidi
Date: 2010/11/16 - 12:34
Replying to [comment:15 sdlime]:

The new patch should correctly handle WCS 2.0 requests when compiled with missing libxml2 support.

Author: Schpidi
Date: 2010/11/29 - 18:22
I've uploaded a new patch fixing some bugs and adding scaling functionality.

Please note that there is no extension available yet specifying scaling. Thus we have to guess how this will be specified. Please find some sample requests in the second patch which is for msautotest. I've also added a zip containing the expected results for all new tests as far as the current implementation supports them.

Stephan

Author: sdlime
Date: 2010/12/10 - 07:27
Stephan: Tried applying the mapserver_trunk_r10771_20101129.patch but failed. I think because of Alan's big change to make memory management more robust (58fc3ab (r10772)). Any chance you could update your patch to go against his changes too?

Steve

Author: Schpidi
Date: 2010/12/10 - 10:43
Steve,

I did also ran into that but didn't find time yet to resolve it. I'll try my best to upload a new patch soon.

Did you also see the patch for msautotest? It includes an extension to support POST tests. I'll update that patch too.

Stephan

Author: Schpidi
Date: 2010/12/20 - 18:09
Updated patch uploaded. This patch includes all the changes from the previous ones as well as some new enhancements.

Additionally there's a patch and expected results for msautotest.

Stephan

Author: sdlime
Date: 2010/12/20 - 18:43
Great Stephan! I'll apply these this evening and report back here...

Steve

Author: Schpidi
Date: 2010/12/21 - 15:10
Uploaded a new version of the patch. The old one accidentally included too many files.

Stephan

Author: sdlime
Date: 2010/12/22 - 05:48
Applied new version of the patch (mapserver_trunk_r10808_20101221.patch) in 126a0d1 (r10810). Need to make sure this code is patched further to adhere to some new coding guidelines in 6.0:

http://trac.osgeo.org/mapserver/wiki/CodingGuidelines

I looked only briefly at the mapfile.c changes and noticed some strcpy, malloc and strdup calls that could use the new functions outlined at the link above.

Steve

Author: sdlime
Date: 2010/12/22 - 06:01
Applied msautotest patch (msautotest_trunk_r10806_20101220.patch) in mapserver/msautotest_DEPRECATED@a800441 (r10811).

Steve

Author: sdlime
Date: 2010/12/22 - 06:05
Added expect test results in mapserver/msautotest_DEPRECATED@fbef183 (r10812). Should be all caught up. -Steve

Author: Schpidi
Date: 2010/12/22 - 10:42
We changed several of these calls but obviously we didn't catch all, sorry. I'll take a look into it.

Stephan

Author: sdlime
Date: 2010/12/22 - 16:37
No worries, just didn't want to lose the task... ;-)

Author: Schpidi
Date: 2010/12/22 - 18:08
Uploaded another patch including fixes to adhere to new coding guidelines and some OWS functionality.

Please note that in mapfile.c we only changed code in the function where we added new code before.

Stephan

Author: sdlime
Date: 2010/12/31 - 18:36
Whoops, missed these new patches. Applied to trunk in e2c8cd2 (r10818) and mapserver/msautotest_DEPRECATED@b42ae7d (r10819).

Steve

Author: Schpidi
Date: 2011/01/06 - 14:24
The new patch resolves a weird segmentation fault on specific architectures and two others.

Author: Schpidi
Date: 2011/02/15 - 13:14
I've added tickets #3680, #3681, and #3682 instead of the above patch.

Author: sdlime
Date: 2011/03/04 - 05:07
I've lost track of where we are. Can this be closed now? I'm thinking so...

Steve

Author: Schpidi
Date: 2011/03/04 - 14:32
I guess I should add some documentation. I plan to add this at the Code Sprint at the latest.

Author: schpidi
Date: 2011/03/30 - 13:09
Added documentation in mapserver/docs@bffbb39 (r11382) (first changes accidentally in ee03bfc (r11379)).

sdlime was assigned Apr 5, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment