Repository navigation
Description
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
xsandysas 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 to0.0whenabs(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_Affineoverload. Fortx = 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, andskewshare 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
[apacheGH-3147] Share affinity origin parsing
[GH-3147] Implement distributed GeoPandas skew (#3148)