[GH-3203] Preserve Geography coordinates and polygon ring semantics - #3207
Merged
Conversation
jiayuasu
force-pushed
the
fix/geography-wkb-text
branch
from
July 29, 2026 17:48
410080d to
e9c065c
Compare
# Conflicts: # common/src/main/java/org/apache/sedona/common/geography/Functions.java
jiayuasu
marked this pull request as ready for review
July 30, 2026 07:56
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 [BUG]: WKBGeography object rendering truncates coordinates #3203.What changes were proposed in this PR?
WKBGeography.toString()andtoEWKT()output from the authoritative stored WKB/JTS representation.ST_GeomToGeographyvalues directly from JTS WKB so conversion does not introduce longitude/latitude drift.PrecisionModeltext overloads on the S2 writer for callers that request precision-controlled output.Spark DataFrame display now agrees with WKB-backed structural functions such as
ST_AsText. Spark and Flink use the same Geography reader and predicate behavior.Polygon semantics
Public Geography polygon shells are normalized to an area of at most one hemisphere. A shell intended to represent more than half the sphere is interpreted as its complement, and reversing its coordinate sequence does not select the larger region. Structural WKB/WKT remains unchanged.
Raster distance predicates are the deliberate exception. Their internal conversion preserves the orientation of a reprojected raster footprint because that directed footprint may legitimately cover more than half the sphere.
Performance
The single-ring
WkbS2Shapepath computes orientation and origin containment without an additional full edge scan. In a local warmed-up benchmark using a 25,000-vertex polygon:How was this patch tested?
BroadcastIndexJoinSuite: 66 tests, 0 failures, including rasterRS_DWithincoverage.Did this PR include necessary documentation updates?
ST_Area,ST_Contains,ST_Intersects, andST_Within.