Skip to content

[GH-3162][GH-3163][GH-3164] Add distributed GeoSeries geometry methods - #3165

Merged
jiayuasu merged 3 commits into
apache:masterfrom
jiayuasu:feature/geopandas-geometry-methods
Jul 25, 2026
Merged

[GH-3162][GH-3163][GH-3164] Add distributed GeoSeries geometry methods#3165
jiayuasu merged 3 commits into
apache:masterfrom
jiayuasu:feature/geopandas-geometry-methods

Conversation

@jiayuasu

Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

  • Add distributed GeoSeries.has_m and GeoDataFrame delegation using native Sedona expressions. Mixed-dimensional GeometryCollections check all component points so their result matches GeoPandas.
  • Add distributed GeoSeries.minimum_clearance_line and GeoDataFrame delegation using ST_MinimumClearanceLine, while retaining the input SRID for degenerate geometries.
  • Add distributed GeoSeries.constrained_delaunay_triangles and GeoDataFrame delegation using ST_TriangulatePolygon. Empty inputs return an SRID-preserving empty GeometryCollection instead of reaching the JTS empty-polygon failure path.
  • Add direct edge-case, metadata, delegation, and version-gated GeoPandas parity tests.

All three methods remain lazy and distributed; they do not collect geometry data to the driver or use Python row UDFs.

How was this patch tested?

  • Ran focused direct and GeoPandas parity tests for all three methods: 6 passed.
  • Ran the neighboring has_z, delaunay_triangles, and minimum_clearance direct and parity tests: 6 passed.
  • Ran the repository pre-commit hooks on all changed files.
  • Verified the three API examples against a local Spark session.

Did this PR include necessary documentation updates?

  • Yes, I am adding new APIs using the current SNAPSHOT version, v1.9.1.
  • Yes, I added API docstrings, examples, return descriptions, and related-method references.

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 extends Sedona’s distributed GeoPandas-like API by adding three lazy, fully-distributed GeoSeries geometry methods (and GeoDataFrame delegation) implemented via native Sedona Spark SQL expressions, along with direct and GeoPandas parity tests to validate behavior and metadata preservation.

Changes:

  • Add distributed GeoSeries.has_m with special handling for mixed-dimensional GeometryCollection parity with GeoPandas.
  • Add distributed GeoSeries.minimum_clearance_line using ST_MinimumClearanceLine while preserving SRID.
  • Add distributed GeoSeries.constrained_delaunay_triangles using ST_TriangulatePolygon, with SRID-preserving empty-input handling and new direct/parity tests.

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 has_m, minimum_clearance_line, and constrained_delaunay_triangles using Sedona expressions and edge-case handling.
python/sedona/spark/geopandas/base.py Adds GeoDataFrame/GeoSeries delegation and docstrings/examples for the new APIs.
python/tests/geopandas/test_geoseries.py Adds direct tests for edge cases, SRID/CRS/index preservation, and delegation behavior.
python/tests/geopandas/test_match_geopandas_series.py Adds version-gated GeoPandas parity tests for the new APIs.
Comments suppressed due to low confidence (1)

python/tests/geopandas/test_match_geopandas_series.py:920

  • shapely.geos_version_string may include extra suffixes (e.g. 3.11.2-CAPI-...) that are not PEP 440–compatible, which can make packaging.version.parse(...) raise InvalidVersion or behave unexpectedly. Parse only the leading numeric part before doing the GEOS version gate.
        if parse_version(shapely.__version__) < parse_version("2.1.0"):
            pytest.skip(
                "geopandas constrained_delaunay_triangles requires shapely 2.1.0 or higher"
            )
        if parse_version(shapely.geos_version_string) < parse_version("3.10.0"):
            pytest.skip("constrained_delaunay_triangles requires GEOS 3.10.0 or higher")

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +790 to +793
if parse_version(shapely.__version__) < parse_version("2.1.0"):
pytest.skip("geopandas has_m requires shapely 2.1.0 or higher")
if parse_version(shapely.geos_version_string) < parse_version("3.12.0"):
pytest.skip("has_m requires GEOS 3.12.0 or higher")
@jiayuasu jiayuasu added this to the sedona-1.9.1 milestone Jul 25, 2026
@jiayuasu
jiayuasu marked this pull request as ready for review July 25, 2026 05:35
@jiayuasu
jiayuasu merged commit 9a88736 into apache:master Jul 25, 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

2 participants