Open mwjsanders opened 7 years ago
The geometry validation currently relies on the deegree library, which in turn uses the JTS library to determine the orientation of the rotation.
However, I think the result is correct. In the left-handed coordinate system that is used (first axis up, second axis right) the rotation is clockwise. In a right-handed system like in a typical map projection (first axis right, second axis up) it would be counter-clockwise. That is at least my understanding...
If that analysis would be correct: Can it be the case that the native coordinate reference system in the DB uses a coordinate system with lon/lat or east/north (which would explain the ST_Orientation result) and the orientation is not considered in the conversion to ETRS89 lat/lon?
@cportele I am not sure that the analysis is a correct: as I see it, the exterior boundary of a surface has a certain orientation. This orientation does not change when the boundary's coordinates are expressed in another coordinate system, also not when that coordinate system has the opposite orientation of the original coordinate system (right-handed vs. left-handed).
@heidivanparys - Why has the CRS no effect on the orientation of a ring? As I understand it, the orientation is the orientation of the geometry in its CRS. It it is not necessarily, for example, the orientation of the ring drawn on the Earth surface when viewed from space.
From the new edition of ISO 19107 (DIS):
For surfaces, the orientation reflects which direction is "up", the "top" of the surface being the direction of a completing "z-axis" that would be the local upward.
That is, the z-axis points in a different direction whether you use a left-handed or right-handed CRS.
Anyhow: Since most software seems to have no problems with "incorrect" orientations (they just need to know whether it is an exterior or interior boundary), maybe this requirement should not be a requirement - and not be tested.
See #137. @heidivanparys is right, this is a bug and the test has to be updated for coordinates in a left-handed CRS (like ETRS89 lat/lon).
We are moving forward with this issue. The pull request https://github.com/deegree/deegree3/pull/1034 with a fix in deegree to be used in the ETF code has been accepted. Whenever the new release is ready, we will integrate it on the validator. Will keep you posted.
I also get that fatal error: outer ring is clockwise. Checked in qgis node succesion is ccw crs epsg:303. Tested with a simple dataset, 2 records, simple geometries in zip the tested gml and the test report stortplaatsen_inspire_ccw_tf.zip
Dear @esevens,
a fix for this issue is available in the BETA instance of the validator, I tested your sample dataset and it validates without errors (see test report).
Any other test and feedback is more than welcome. Please use the Validator helpdesk for reporting issues.
@fabiovinci Just tested with this dataset using EPSG:4258 but the error is still occurring export4258.zip
Hi @JohannaOtt, I tested your dataset in the BETA instance and it validates (see the report) ;-)
Is the beta instance something else than the staging instance?
Yes ;-) See Release strategy document
Manages to miss that, thanks a lot for the info!
@fabiovinci I can confirm the error is gone (at least for EPSG:4258). That is great news and will make the use of the validator so much more convenient!
@fabiovinci
Is the this fix included in the v2023.2
release? I see that #950 fix is included in the release notes of this version but I am still getting this error in the validator.
My geometries are in EPSG:4258 (N-E), and the extrerior ring is CounterClockWise
Dear @IoannaTsakalakidou,
yes, the fix is included in the last release. Could you please provide your dataset to reproduce the error?
Here is a sample of my dataset:
Dear @IoannaTsakalakidou,
looking at your gml in QGIS, it seems that polygons with holes (e.g.
Could you please verify?
To check the orientation I used 3 different methods in python, 1.built-in shapely function, 2. by plotting 3 points with the order they appear in the polygon, 3. with the signed area method (check script in attached .ipynb). They all show that the orientation is CCW.
When using the extract vertex
tool in QGIS I get the same orientation as you, so ClockWise. I am just not sure what happens "behind the scenes" of this tool.
At this point, I am not sure which method's results are right, and it seems that finding the orientation of geometries is quite a vexing problem :)
- Some notes regarding the attached script: the polygon used as an example is an exterior ring I copied from the .gml. Some pre-processing is done in a text editor to turn the space separated coords into tuples of (x,y) (as required for Shapely geometries) - In case you are not working with python or jupyter notebooks I can also provide some screenshots of the methods used polygon_orientation_check.zip
To check the orientation I used 3 different methods in python, 1.built-in shapely function, 2. by plotting 3 points with the order they appear in the polygon, 3. with the signed area method (check script in attached .ipynb). They all show that the orientation is CCW.
When using the
extract vertex
tool in QGIS I get the same orientation as you, so ClockWise. I am just not sure what happens "behind the scenes" of this tool.At this point, I am not sure which method's results are right, and it seems that finding the orientation of geometries is quite a vexing problem :)
- Some notes regarding the attached script: the polygon used as an example is an exterior ring I copied from the .gml. Some pre-processing is done in a text editor to turn the space separated coords into tuples of (x,y) (as required for Shapely geometries) - In case you are not working with python or jupyter notebooks I can also provide some screenshots of the methods used polygon_orientation_check.zip
UPDATE: The validator works as it should. The polygons are indeed ClockWise! The polygons in gml are in lat lon (e.g 50, 5). So when reading them as a shapely polygon they had to be swapped into x, y (5, 50). This is what I missed before and the orientation appeared to be CCW. Sorry for the confusion :)
@fabiovinci Couldn't this be closed?
I am faced with an unexpected validation error when validating the GML Application schema. The validation error states that the outer ring of the polygon is not counter clockwise while in fact it is counter clockwise. I validated a GML feature from the GeographicalName dataset:
The validation report states:
The feature geometry is not a valid GML geometry. Error detected: Invalid polygon. Outer ring of polygon is clockwise within element Polygon, (gml:id: geom.geographicalname.695325 with coordinates: LINESTRING (51.522418 3.604928,51.522808 3.604913,51.522807 ...)
The Polygon is stored in a postgres db and according to the ST_Orientation function the outer ring is counterclockwise and there is no transformation on the geometry when the complex feature is being build.