piyushka-ally opened a new pull request, #2784: URL: https://github.com/apache/sedona/pull/2784
## Did you read the Contributor Guide? - Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/) ## Is this PR related to a ticket? - Yes, and the PR name follows the format `[GH-XXX] my subject`. Closes #2230 ## What 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 [GeoPandas `clip_by_rect`](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.clip_by_rect.html) interface. 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 list - `python/sedona/spark/geopandas/base.py` — Base class delegation with docstring and examples - `python/sedona/spark/geopandas/geodataframe.py` — Priority list registration - `python/tests/geopandas/test_geoseries.py` — Unit tests (polygon, line, point, None, GeoDataFrame) - `python/tests/geopandas/test_match_geopandas_series.py` — GeoPandas comparison tests over `self.geoms` ## How 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 access - `tests/geopandas/test_match_geopandas_series.py::test_clip_by_rect` — iterates over all geometry types in `self.geoms` and compares Sedona output against GeoPandas (skipping LinearRing, GeometryCollection, and invalid geometries due to JTS/GEOS boundary-handling differences) - Full geopandas test suite (`pytest tests/geopandas/`) — no regressions introduced - Pre-commit hooks all pass (`make check`) ## Did this PR include necessary documentation updates? - No, this PR does not affect any public API documentation — it implements an existing stub method that was already part of the planned API surface (tracked in #2230). A docstring with examples is included inline. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
