Skip to content

[GH-3175] Add Geography support for ST_Intersection - #3223

Merged
jiayuasu merged 3 commits into
apache:masterfrom
jiayuasu:feature/geography-intersection
Aug 1, 2026
Merged

[GH-3175] Add Geography support for ST_Intersection#3223
jiayuasu merged 3 commits into
apache:masterfrom
jiayuasu:feature/geography-intersection

Conversation

@jiayuasu

Copy link
Copy Markdown
Member

What changes?

  • Add Geography support for ST_Intersection in the common, Spark, Python, and Flink APIs.
  • Compute intersections on the sphere with S2 closed-set semantics, including point/line/polygon mixed-dimensional results.
  • Preserve the first input SRID, emit XY results, and return dimension-appropriate empty Geography values.
  • Align vertex-on-edge and collinear inputs when Java S2 requires explicit noding, while retaining a fast path for ordinary intersections.
  • Support ISO and EWKB Geography values with Z/M ordinates in spherical operations; the intersection result intentionally drops Z/M.
  • Add Spark and Flink documentation, examples, API index entries, and updated visuals.

Why?

ST_Intersection previously accepted Geometry inputs only. Geography users had no spherical overlay operation and would otherwise need to convert to planar Geometry, producing incorrect results for geodesic edges and large geographic extents.

Behavior

  • Uses geodesic edges and S2 spherical overlay semantics.
  • Treats polygon and polyline boundaries as closed.
  • Preserves the SRID of the first input without transforming either operand.
  • Returns NULL when either input is NULL.
  • Returns a first-SRID GEOMETRYCOLLECTION EMPTY when an explicit operand is empty, and a typed empty result for disjoint nonempty inputs.
  • Inherits Sedona Geography ring-role and hemisphere normalization semantics.

Validation

  • Common Geography/WKB tests: 140 passed.
  • Spark Geography and SRID tests: 92 passed.
  • Spark Geometry regression suite: 235 passed.
  • Flink Geography tests: 26 passed.
  • Flink Geometry ST_Intersection regression: 1 passed.
  • Formatting and whitespace checks passed.

Closes #3175.

@jiayuasu
jiayuasu marked this pull request as ready for review August 1, 2026 05:28
@jiayuasu
jiayuasu merged commit 55a3bf3 into apache:master Aug 1, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Geography support for ST_Intersection

1 participant