Hello Everyone,
I am sending this email to both geotools and geoserver lists because the matter concerns both.
I recently made a PR to improve geotools/geoserver behaviour with respect to multiple geometries that have different CRS. (https://github.com/geotools/geotools/pull/3642) One of the matters that is being discussed between Andrea and me is the expected behaviour on reprojection.
I attempted to follow the instructions and examples given for the "srsName" parameter specified by the OCR WFS2.0 specs (https://docs.opengeospatial.org/is/09-025r2/09-025r2.html#95) These seem to suggest that geometries that have a 'incompatible' CRS are simply not reprojected, without failure. The only example given for 'incompatibility' is having a different dimension. Andrea noted that transformation only fails in the direction 2D->3D while it works the other way around, so that it should still be reprojected in that case. However, the example given in the specs suggests explicitely that a 3D geometry would not be converted to a 2D srsName. This seems to be what is expected in my use case as well.
The problem is complicated further by the fact that in geoserver, the implementation of GetFeature sometimes explicitly specifies a reprojection CRS in the query, even if there was no srsName in the http request (the reason has something to do with how different wfs versions handle crs encoding and axis order. ) What would happen then is that even when no srsName is specified, the 3D CRS is always being transformed to 2D, which is clearly unwanted behaviour.
Inspire schemas often require feature types with a (primary) 2D geometry and a (secondary) 3D geometry.
Kind Regards
Niels