[GH-3143] Implement distributed GeoPandas scale - #3145
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a distributed, GeoPandas-compatible scale operation to Sedona’s Spark GeoPandas layer by expressing scaling as a per-row ST_Affine transform (including Z scaling) while delegating GeoDataFrame behavior through the existing active-geometry delegation.
Changes:
- Added
GeoSeries.scale(...)implemented viaST_Affinewith per-row"center"/"centroid"origins and support for 2D/3D tuple and ShapelyPointorigins. - Added GeoDataFrame/GeoSeries base-level delegation entrypoint for
.scale(...). - Added focused regression tests plus GeoPandas parity tests covering 2D/3D families, origins, factor validation, nulls/typed-empties, and metadata preservation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/sedona/spark/geopandas/geoseries.py | Implements distributed GeoSeries.scale using ST_Affine with validated factors/origins and empty-geometry guarding. |
| python/sedona/spark/geopandas/base.py | Adds .scale(...) delegation via the active geometry column to match GeoPandas GeoDataFrame behavior. |
| python/tests/geopandas/test_geoseries.py | Adds direct regression/validation tests for factors/origins, 2D/3D behavior, metadata preservation, and delegation. |
| python/tests/geopandas/test_match_geopandas_series.py | Adds GeoPandas parity tests for 2D/3D scaling across geometry families and origins. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What changed
GeoSeries.scaleand active-geometry delegation fromGeoDataFrame.ST_Affineexpression with per-row center or centroid origins.Why
This implements #3143 without materializing geometries on the Spark driver. The existing scale functions do not provide both GeoPandas-compatible per-row origins and Z scaling, so the operation is expressed as an affine transform with offsets derived from each origin.
Validation
23 passedin the focused GeoPandas scale test suite.Closes #3143