-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[OGC] Polygon: fix rings order #55306
Conversation
@lbartoletti A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
Slight side tracking: determining which side is the top and which one is the bottom depends on the convention of the editing tool. Your change assumes that the editor looks at polygons from the top, which is a reasonable one. But for a 3D shape and 3D editor, determining the top from the inside cannot be just done by looking at the coordinates of the vertex of the ring (for vertical polygons,, the usual method would return a "random" value). You need to take into account the whole shape to determine the top from the bottom. The addition of the constraint "exterior boundary = counter-clock-wise" is something "new" in SFA 1.2.1 - 06-103r4 (https://www.ogc.org/standard/sfa/). It is not present in SFA 1.1.0 - 05-126, which might perhaps explain why GEOS doesn't take that into account. |
Thanks @rouault for your insight.
Yes, what I should have written was that QGIS now allows you to mix the order of the interior rings; this is the most problematic aspect for me. Whether CW or CCW, all interior rings must have the same direction, which is not the case today.
Do you think, it's applicable for these tools? I suggest enforcing the digitalization of new geometry, but we can still apply CW or CCW with some algorithms/expressions in QGIS.
Yes, you're right. I was a baby geomatician when the new standard has landed. :) To be clear, I don't blame GEOS. |
What you propose is probably OK and I don't strongly object, but I'd say the tools you're trying to be compatible with should only enforce the OGC rules when displaying/working with 3D volumes, not 2D surfaces where the concept of top/outside or bottom/inside doesn't really make sense. But if we are trying to be fully compatible with those tools (can be they named :-) ?), that's a lot of effort because they're plenty of places in QGIS, GDAL or GEOS where changes would have to be made. |
At the very least, the case that poses a real issue for me is the potential disorder when digitizing the rings and parts. |
that indeed makes sense |
e157e78
to
610e441
Compare
I've made the changes so that the parts are in the same direction as the first exterior ring and the reverse for the interior rings, and I'm not forcing the direction of the main exterior ring. |
…ntinel or for empty (multi)polygon
8c3e4d8
to
6b6ed33
Compare
972dbc2
to
d7d3cdc
Compare
@lbartoletti |
Hi @lbartoletti, please see #58333. |
Description
I'm reaching out regarding an important initiative aimed at rectifying an anomaly observed in the digitization process within QGIS. Specifically, the adherence to OGC standards, upon which QGIS relies, dictates a distinct orientation requirement for polygon rings.
As per the OGC norm, the exterior boundary LinearRing must define the "top" of the surface, following a counterclockwise traversal along the boundary. Conversely, interior LinearRings should exhibit an opposite orientation, appearing clockwise when viewed from the "top."
Presently, there's a lack of verification within QGIS to ensure adherence to this prescribed behavior. To address this issue, I'll be initiating a series of PR; focusing only on the digitization process here. The primary goal is to align the behavior more closely with the established standards.
Nevertheless, I intend to maintain flexibility in the codebase, allowing for the preservation of the previous behavior programmatically. This approach aims to avoid directly enforcing orientation within the *Polygon classes. So, classes still accept "unordered" rings.
Before:
before-converted.mp4
After:
after-converted.mp4
PS: The motivation behind this is that certain tools perform stricter checks than the ones we currently conduct or those performed with GEOS.
PS2: I'm aware that ESRI Shapefile is CW unlike OGC, but should be a provider role to check this part?
TODO: