QGIS-Documentation
QGIS-Documentation copied to clipboard
[OGC] Polygon: fix rings order (Request in QGIS)
Request for documentation
From pull request QGIS/qgis#55306 Author: @lbartoletti QGIS version: 3.36
[OGC] Polygon: fix rings order
PR Description:
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:
https://github.com/qgis/QGIS/assets/7521540/1459266c-7c5d-4d91-8d4f-662c1cdcb6c5
After:
https://github.com/qgis/QGIS/assets/7521540/51e43cd4-2cbf-4f95-94fe-5c2ba9d48b21
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:
- [ ] fix tests
- [x] add test
Commits tagged with [need-docs] or [FEATURE]
The "after" video is not good, since we change slighty the behaviour.
since we change slighty the behaviour.
Which if I understood is "that if the exterior ring is in one direction, all interior rings are in the opposite direction, and the parts follow the direction of the exterior ring"? Exterior rings of different features do not necessarily follow the same direction, right? Now, for the user manual, why would someone need to know this? Changelog info? And if docs, where would this land for you?
Which if I understood is "that if the exterior ring is in one direction, all interior rings are in the opposite direction, and the parts follow the direction of the exterior ring"?
Exact
Exterior rings of different features do not necessarily follow the same direction, right?
Exact
Now, for the user manual, why would someone need to know this? Changelog info?
Because, if you draw with an arrow style, you'll see the orientation of your ring potentially inverted and can cause interrogation. These kinds of rules are not known by many geomaticians and an explanation could be written, thought.
And if docs, where would this land for you?
In https://docs.qgis.org/3.28/fr/docs/user_manual/working_with_vector/editing_geometry_attributes.html#add-part and https://docs.qgis.org/3.28/fr/docs/user_manual/working_with_vector/editing_geometry_attributes.html#add-ring