OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.79k stars 2.51k forks source link

WCS 2.0.1: server error caused by 'format' parameter in 'DescribeCoverage' requests #8381

Closed duswie closed 1 year ago

duswie commented 1 year ago

Expected behavior and actual behavior.

Expected: gdal wcs driver should be able to open this public WCS 2.0.1 source.

Actual: gdalinfo fails with :

ERROR 1: HTTP error code : 400
ERROR 1: InvalidRequest: Parameter 'format' is not valid in request.
gdalinfo failed - unable to open 'WCS:http://inspire-hessen.de/raster/dgm1/ows?version=2.0.1&coverage=he_dgm1'.

Investigation

This server error is caused by the 'format' query parameter (FORMAT=text/xml) in the DescribeCoverage request made by the wcs driver: GET /raster/dgm1/ows?SERVICE=WCS&REQUEST=DescribeCoverage&VERSION=2.0.1&COVERAGEID=he_dgm1&FORMAT=text/xml

According to OGC® WCS 2.0 Interface Standard- Core (Figure 7) DescribeCoverage requests must not contain a format parameter.

In my opinion the 'format' paratmer should be removed or be suppress able by option in 'DescribeCoverage' requests: https://github.com/OSGeo/gdal/blob/7f18ca5ecc7fa928625aba197b10900e8119f296/frmts/wcs/wcsdataset201.cpp#L379

Steps to reproduce the problem.

run gdalinfo "WCS:http://inspire-hessen.de/raster/dgm1/ows?version=2.0.1&coverage=he_dgm1"

Operating system

macOS 13.5.1 (22G90) - Ventura - Intel

GDAL version and provenance

3.7.1 from Homebrew

jratike80 commented 1 year ago

I tried to find out if extra parameters are allowed only in some OGC standards (that would not surprise me). I have thought that if server does not know them they should be skipped. WFS 2.0 standard says:

A server may implement additional KVP parameters that are not part of this International Standard. These are known as vendor-specific parameters. VSPs allow vendors to specify additional parameters that will enhance the results of requests. A server shall produce valid results even if the VSPs are missing, malformed or if VSPs are supplied that are not known to the server. Unknown VSPs shall be ignored.

Same idea in Catalogue Services 3.0. In WMS 1.3.0 it is put

A WMS shall be prepared to encounter additional request parameters that are not part of this International Standard. In terms of producing results per this International Standard, a WMS shall not require such parameters.

It may be that WCS 2.0.1 is strict. Anyway &format= is never needed in DescribeCoverage.

Geoserver seems to accept extra parameters but I do not mean that Geoserver does it right, just documenting how it behaves. http://localhost:8080/geoserver/ows?service=WCS&acceptversions=2.0.1&request=GetCapabilities&foo=bar

I checked also some old WCS standards, WCS 1.0.0 must accept extra parameters in GetCoverage but not in DescribeCoverage.

Conclusion: 1) I think this is a bug in GDAL. 2) I suggest to contact the service provider and ask them to correct their configuration for getting the CRS right:

<gml:Point gml:id="he_dgm1-point" srsName="http://localhost:8080/rasdaman/def/crs/EPSG/0/25832">
<gml:pos>412000 5723999</gml:pos>