Hello,
we have a problem using WCS with layers that have a native CRS different than the declared CRS.
We do e.g. have data defined on very particular meteorological CRS (which we have defined in the user_projections file). Now as we don’t want this to be the declared CRS, we have configured the layer as such:
- native CRS: EPSG:100002 (defined by the data)
- declared: EPSG:4326
- projection handling: reproject native to declared
Now the problem is that for WCS requests on that data, the requests usually fail because of the spatial subsetting.
A typical request that should fail would be such:
http://localhost:8080/geoserver/ows?service=WCS&version=2.0.1&request=GetCoverage&coverageId=dwd.modeldata__ICON-D2.Temperature.height_level_above_ground&format=application/x-netcdf&subsettingCRS=http://www.opengis.net/def/crs/EPSG/0/4326&subset=Long(7,13)&subset=Lat(45,55)&outputCRS=http://www.opengis.net/def/crs/EPSG/0/4326&subset=elevation(2)&subset=time(%222025-04-07T06:00:00.000Z%22)&subset=REFERENCE_TIME(%222025-04-07T00:00:00.000Z%22)
The important part is this:
subsettingCRS=http://www.opengis.net/def/crs/EPSG/0/4326&
subset=Long(7,13)&subset=Lat(45,55)&
outputCRS=http://www.opengis.net/def/crs/EPSG/0/4326
We would like to be able to specify lon/lat coordinates for the request, and the output should also be in EPSG:4326.
Such a request fails with the error Splitting requests returned nothing
.
The problem seems to be that the coverage reader that builds the granule source only knows the native CRS and therefore builds all granules using that CRS.
Now WCS dimension sub-setting helper, when it builds the granule query would have to reproject the request envelope (in our case EPSG:4236) to the native CRS for the spatial query. For strange reasons that doesn’t seem to be happen. It seems to build the query from the declared CRS and since both match (in our case EPSG:4326) nothing is reprojected.
Later when the filter is executed and the granule geometries are intersected with the request envelope, this will of course fail badly, because it intersects polygons built from different CRSs. This will fail in most cases, but could even be worse, because it could even sometimes succeed falsly.
The code that seems wrong is in org.geoserver.wcs2_0.response.WCSDimensionsSubsetHelper#extractSubsettingEnvelope
It seems as if it should be using the native CRS (coverageInfo#getNativeCRS()
) there instead of the declared CRS (coverageInfo#getCRS()
). Then, the query should have it’s request envelope reprojected to the native CRS of the data.
Has anybody noticed something like that before? Could this be a bug, or are we misinterpreting the CRS handling of WCS?
Thanks!
Sören