generated from linz/template-python-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### Motivation When an existing capture-area geometry is being modified (polygon being removed/added), as a result the polygons points can be moved around. When the overall geometry ends up being the same (no visual change), we prefer the capture-area geometry to not show a change (difference between existing and new/re-processed one). ### Modifications - Use [shapely.normalize()](https://shapely.readthedocs.io/en/2.0.3/reference/shapely.normalize.html) to keep the geometry consistent. What does `shapely.normalize()`? According to [the official documentation](https://shapely.readthedocs.io/en/latest/geometry.html#canonical-form): > - the coordinates of exterior rings follow a clockwise orientation and interior rings have a counter-clockwise orientation > - the starting point of rings is lower left > - elements in collections are ordered by geometry type: by descending dimension and multi-types first (MultiPolygon, Polygon, MultiLineString, LineString, MultiPoint, Point). Multiple elements from the same type are ordered from right to left and from top to bottom. Because, "_the coordinates of exterior rings follow a clockwise orientation and interior rings have a counter-clockwise orientation_" is going against [RFC 7946](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6) - "_A linear ring MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise._", we need to apply `orient()` after `normalize()` the geometry. ### Verification - Unit tests - Other tests to come in #1224
- Loading branch information
1 parent
b96c851
commit 0a061ba
Showing
3 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters