Invalid GML srsDimension on GmlGeoX v1 #102
Labels
EIP-approved
EIP approved by the Steering Group
Impl.
EIP has been implemented and is ready for the next release. Doc might be incomplete (temp. label)
Milestone
Background and Motivation:
It has been detected that during the parsing of some GML files errors occur in the etf-bsxtd library.
These are files in which the number of dimensions of the geometry has been declared using the srsDimension attribute.
The error occurs when the value indicated in that attribute does not match the number of dimensions associated with the SRS declared in the geometry file.
The error seems to occur only when the srsDimension attribute is declared in the same tag where the srsName attribute is indicated. However, it disappears when srsDimension is moved to the gml:posList tag that contains the list of coordinates.
This is a memory leak that only manifests itself when the geometry is large enough, although it is linked to parsing errors even when the testdriver execution is completed.
Each CRS has implicitly associated the number of dimensions of the geometry expressed in that CRS.
Thus, for example, declaring srsName="http://www.opengis.net/def/crs/EPSG/0/4258" establishes that the geometry must have 2 dimensions.
When the srsDimension="3" attribute is declared in the same tag, the value of srsDimension is ignored, and the coordinates of the file are parsed incorrectly.
In that case, errors like this occur:
That is, a two-dimensional geometry is interpreted from a list of three-dimensional coordinates.
This produces a mismatch in all coordinates, a change in the number of points in the geometry, prevents the first and last point from coinciding in closed geometries, etc.
Also, if the number of coordinates is not multiple of 6 in this example (the least common multiple of the SRS dimensions and those declared in the file), not all the points can be correctly constructed and memory errors can occur during the parse.
This is not an error in the validation of the GML file, but the parsing of the file prior to validation.
The deegree library recognizes and parses correctly the srsDimension attribute in the gml:posList tag, but not in gml:Surface, where the srsName attribute is indicated. However, there are GML files that indicate the number of dimensions precisely in that tag.
This same problem with certain GML files occurs in other tools:
https://trac.osgeo.org/gdal/ticket/5606
http://osgeo-org.1560.x6.nabble.com/Adding-srsDimension-at-the-posList-level-too-td5087644.html
Proposed change
A pre-validation of GML files is proposed to reject those that indicate a number of dimensions in the geometry other than the number of dimensions corresponding to the indicated SRS.
This pre-validation would be done before the validation with deegree.
The following changes are proposed:
If the GML file does not pass the pre-validation, corresponding exceptions are added in the GeometryElementHandler to generate an additional message for the element indicating that it does not comply with the correct GML format.
It is considered that the same changes of GeometryElementHandler should be reproduced in the SecondaryGeometryElementValidationHandler class.
Alternatives
In addition to the proposed solution described in the previous section, these other alternatives have been considered:
Funding
N/A
Additional information
N/A
The text was updated successfully, but these errors were encountered: