-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected validation error on counterclockwise polygon #60
Comments
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):
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 deegree/deegree3#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 |
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. |
@fabiovinci Just tested with this dataset using EPSG:4258 but the error is still occurring |
Hi @JohannaOtt, |
Is the beta instance something else than the staging instance? |
Yes ;-) |
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 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. |
Here is a sample of my dataset: |
Dear @IoannaTsakalakidou, looking at your gml in QGIS, it seems that polygons with holes (e.g. <ge:MappedFeature gml:id="nl-tno-ge-oggk.v2021-01-1.MappedFeature.dsg">) have exterior boundaries in ClockWise order, so, in this case, the error is right. 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 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) |
UPDATE: The validator works as it should. The polygons are indeed ClockWise! |
@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.
The text was updated successfully, but these errors were encountered: