Repository navigation
[GH-3592] Stop envelope polygons from sharing their closing coordinate - #3593
Merged
jiayuasu merged 1 commit intoNov 27, 2026
Merged
Conversation
polygonFromEnvelope used the same Coordinate object for the first and the last point of the ring. Functions that edit coordinates in place, such as translate, affine and flipCoordinates, then changed that point twice: translate(makeEnvelope(0, 0, 2, 1), 10, 20) returned POLYGON ((20 40, 10 21, 12 21, 12 20, 20 40)) with area 23 instead of POLYGON ((10 20, 10 21, 12 21, 12 20, 10 20)) with area 2. Use a copy of the first coordinate as the closing point.
Member
|
@vera-rubin, would you be willing to fix the same issue in 3D I reproduced it by expanding |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Closes Envelope polygons share their closing coordinate, so ST_Translate/ST_Affine/ST_FlipCoordinates move it twice #3592What changes were proposed in this PR?
Constructors.polygonFromEnvelope(used byST_MakeEnvelope,ST_PolygonFromEnvelopeand the 2DST_Expand) put the sameCoordinateobject at the first and the last position of the ring. Functions that edit coordinates in place then move that point twice.translate(makeEnvelope(0, 0, 2, 1), 10, 20)returnsPOLYGON ((20 40, 10 21, 12 21, 12 20, 20 40))with area 23 instead ofPOLYGON ((10 20, 10 21, 12 21, 12 20, 10 20))with area 2;affineandflipCoordinatesare hit the same way.The closing point is now a copy of the first coordinate.
How was this patch tested?
Added
ConstructorsTest.envelopeCoordinatesAreEditedOnce, which checkstranslate,affine(with an SRID) andflipCoordinateson envelope polygons. It fails without the fix (POLYGON ((20 40, 10 21, 12 21, 12 20, 20 40))) and passes with it.mvn -pl common -am test -Dtest='FunctionsTest,ConstructorsTest'passes (416 tests), andmvn -pl common spotless:checkis clean.Did this PR include necessary documentation updates?
Nathan, ChipLab