[GH-3134] Implement distributed GeoPandas affine_transform - #3135
Merged
jiayuasu merged 2 commits intoJul 22, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements distributed GeoSeries.affine_transform(matrix) (and GeoDataFrame geometry-column delegation) by translating GeoPandas 2D/3D coefficient matrices into Sedona ST_Affine Spark expressions, with validation and parity tests to ensure correctness and metadata preservation.
Changes:
- Added
GeoSeries.affine_transform(matrix)with validation, float normalization, and explicit 3D coefficient reordering for Sedona’sST_Affinewrapper signature. - Added GeoDataFrame/GeoSeries delegation entry and API docstring (including 2D/3D layouts and engine-difference notes).
- Added direct and GeoPandas-parity tests covering 2D/3D behavior, coefficient order regression, metadata/SRID/CRS handling, and validation errors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| python/sedona/spark/geopandas/geoseries.py | Implements GeoSeries.affine_transform using distributed ST_Affine with 2D/3D handling and validation. |
| python/sedona/spark/geopandas/base.py | Adds delegated affine_transform API + docstring for GeoSeries/GeoDataFrame geometry-column delegation. |
| python/tests/geopandas/test_geoseries.py | Adds unit tests for metadata/SRID/CRS preservation, dimension handling, coefficient ordering, and validation. |
| python/tests/geopandas/test_match_geopandas_series.py | Adds GeoPandas parity tests for 2D parametrized matrices and a 3D case across geometry families. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1178
to
+1184
| try: | ||
| matrix = tuple(matrix) | ||
| except (TypeError, ValueError) as exc: | ||
| raise TypeError("'matrix' must be a local ordered sequence") from exc | ||
|
|
||
| if len(matrix) not in (6, 12): | ||
| raise ValueError("'matrix' expects either 6 or 12 coefficients") |
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.What changes were proposed in this PR?
GeoSeries.affine_transform(matrix)and GeoDataFrame geometry-column delegation.ST_AffineSpark expressions without driver collection or Python row UDFs.How was this patch tested?
python -m pytest -p no:cacheprovider -q tests/geopandas/test_geoseries.py tests/geopandas/test_match_geopandas_series.py -k affine_transform— 10 passed.Did this PR include necessary documentation updates?