Skip to content

GeoPandas: implement distributed skew #3147

Closed

Description

@jiayuasu

Part of #2230.

Implement GeoSeries.skew(xs=0.0, ys=0.0, origin="center", use_radians=False) and the corresponding active-geometry delegation from GeoDataFrame.

Requirements

  • Keep execution fully distributed with Spark expressions. Do not use to_geopandas(), collect(), toLocalIterator(), or Python row UDFs in the implementation.

  • Normalize xs and ys as operation-wide numeric scalars. Reject arrays, Series, Spark Columns, and other per-row/distributed values deterministically.

  • Interpret angles as degrees by default and radians when use_radians=True. Match Shapely's exact-zero behavior by setting a tangent to 0.0 when abs(tan(angle)) < 2.5e-16.

  • Support per-row "center" (2D bounding-box center) and "centroid" origins, plus a local nonempty 2D/3D Shapely Point or numeric tuple of length 2/3. Origin Z is ignored.

  • Express the shear through Sedona's 2D ST_Affine overload. For tx = tan(xs), ty = tan(ys), and origin (x0, y0):

    x' = x + tx * (y - y0)
    y' = y + ty * (x - x0)
    xoff = -y0 * tx
    yoff = -x0 * ty
    
  • Preserve existing Z coordinates exactly; 2D inputs must remain 2D.

  • Preserve the index, CRS/SRID, nulls, typed empty geometries, and geometry types. Guard empty geometries before computed-origin expressions so they cannot become null.

  • Document JTS/Shapely differences for mixed-dimensional collections, M/ZM ordinates, NaN Z coordinates, and non-finite angles. Do not collect data to emulate local Shapely behavior.

  • Reuse shared affine-family scalar validation where practical now that affine_transform, scale, and skew share the same contract.

Tests

  • Default, positive, negative, zero, degree, and radian angles, including the 180-degree exact-zero tangent case.
  • "center", "centroid", 2D/3D tuple, and 2D/3D Point origins.
  • Point, LineString, Polygon, multi-geometries, and homogeneous GeometryCollection parity with GeoPandas.
  • Exact 3D regression showing Z preservation and origin Z being ignored.
  • Null and typed empty preservation, named index, CRS/SRID, and GeoDataFrame delegation.
  • Deterministic validation for invalid angles, use_radians, origins, arrays/Series/distributed values, including all-empty input.

Activity

  1. added 2 commits that reference this issue on Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions