Skip to content

[GH-3143] Implement distributed GeoPandas scale - #3145

Merged
jiayuasu merged 1 commit into
apache:masterfrom
jiayuasu:feature/geopandas-scale
Jul 22, 2026
Merged

[GH-3143] Implement distributed GeoPandas scale#3145
jiayuasu merged 1 commit into
apache:masterfrom
jiayuasu:feature/geopandas-scale

Conversation

@jiayuasu

Copy link
Copy Markdown
Member

What changed

  • Add GeoSeries.scale and active-geometry delegation from GeoDataFrame.
  • Build a distributed diagonal ST_Affine expression with per-row center or centroid origins.
  • Support numeric scale factors plus 2D/3D tuple and Shapely Point origins.
  • Preserve nulls, typed empty geometries, indexes, CRS, and SRID metadata.
  • Add direct regression tests and GeoPandas parity coverage across 2D and 3D geometry families.

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 passed in the focused GeoPandas scale test suite.
  • Repository checks pass for all four changed Python files.

Closes #3143

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 via ST_Affine with per-row "center"/"centroid" origins and support for 2D/3D tuple and Shapely Point origins.
  • 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.

@jiayuasu
jiayuasu marked this pull request as ready for review July 22, 2026 19:19
@jiayuasu jiayuasu added this to the sedona-1.9.1 milestone Jul 22, 2026
@jiayuasu
jiayuasu merged commit b8f959f into apache:master Jul 22, 2026
34 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.

GeoPandas: implement distributed scale

2 participants