[GH-2230] Implement GeoSeries.clip_by_rect #2784
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 279 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.337
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2784"
general
weight: 0.35
petern48
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Part of #2230What changes were proposed in this PR?
Implement
GeoSeries.clip_by_rect(xmin, ymin, xmax, ymax)for the Sedona GeoPandas-compatible API. This clips each geometry in a GeoSeries to the given bounding rectangle, matching the GeoPandasclip_by_rectinterface.The implementation composes two existing Sedona SQL functions (
ST_PolygonFromEnvelope+ST_Intersection) so no new Java/Scala code is needed.Files changed:
python/sedona/spark/geopandas/geoseries.py— Core implementation + priority listpython/sedona/spark/geopandas/base.py— Base class delegation with docstring and examplespython/sedona/spark/geopandas/geodataframe.py— Priority list registrationpython/tests/geopandas/test_geoseries.py— Unit tests (polygon, line, point, None, GeoDataFrame)python/tests/geopandas/test_match_geopandas_series.py— GeoPandas comparison tests overself.geomsHow was this patch tested?
tests/geopandas/test_geoseries.py::test_clip_by_rect— verifies clipping behavior for polygon, linestring, interior point, exterior point, None, and GeoDataFrame accesstests/geopandas/test_match_geopandas_series.py::test_clip_by_rect— iterates over all geometry types inself.geomsand compares Sedona output against GeoPandas (skipping LinearRing, GeometryCollection, and invalid geometries due to JTS/GEOS boundary-handling differences)pytest tests/geopandas/) — no regressions introducedmake check)Did this PR include necessary documentation updates?