Skip to content

[GH-2725] Implement GeoSeries: type, unary_union, delaunay_triangles, voronoi_polygons, disjoint, m#2726

Merged
jiayuasu merged 3 commits intomasterfrom
geopandas-tier2-batch-d
Mar 12, 2026
Merged

[GH-2725] Implement GeoSeries: type, unary_union, delaunay_triangles, voronoi_polygons, disjoint, m#2726
jiayuasu merged 3 commits intomasterfrom
geopandas-tier2-batch-d

Conversation

@jiayuasu
Copy link
Member

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

Implement 6 GeoSeries functions for the geopandas compatibility module:

General methods and attributes:

  • type (property) — alias for geom_type, returns geometry type names as a Series
  • m (property) -> ST_M — returns the M coordinate of point geometries

Constructive methods:

  • delaunay_triangles(tolerance, only_edges) -> ST_DelaunayTriangles
  • voronoi_polygons(tolerance, extend_to, only_edges) -> ST_VoronoiPolygons

Binary predicates:

  • disjoint(other, align) -> ST_Disjoint

Aggregation:

  • unary_union (property) — deprecated, delegates to union_all() with FutureWarning

Also fixes GeoDataFrame.type to delegate to geom_type instead of raising NotImplementedError.

Each function follows the established pattern from #2701 and #2710:

  • base.py: Docstring with examples + _delegate_to_geometry_column call
  • geoseries.py: ST function call via _query_geometry_column or _row_wise_operation
  • test_geoseries.py: Unit test with expected values + GeoDataFrame delegation check
  • test_match_geopandas_series.py: Comparison test against real geopandas output

Semantic differences documented:

  • delaunay_triangles and voronoi_polygons operate per row (each input geometry produces a GeometryCollection), unlike geopandas which collects all vertices across the GeoSeries and computes a single result. This is noted in the docstrings.

Not included (blocked by upstream Sedona bugs):

How was this patch tested?

12 new tests (6 unit tests + 6 match tests) all passing locally.

Did this PR include necessary documentation updates?

  • No, this PR does not affect any public API so no need to change the documentation.

…unay_triangles, voronoi_polygons, disjoint, m

Implements 6 GeoSeries functions for the geopandas compatibility module:

- type: property returning geometry type names as a Series (delegates to geom_type)
- unary_union: deprecated property that delegates to union_all()
- delaunay_triangles: element-wise Delaunay triangulation via ST_DelaunayTriangles
- voronoi_polygons: element-wise Voronoi diagram via ST_VoronoiPolygons
- disjoint: binary predicate via ST_Disjoint
- m: returns M coordinate via ST_M

Also fixes GeoDataFrame.type to delegate to geom_type instead of raising
NotImplementedError.

Skipped geom_equals, frechet_distance, hausdorff_distance due to upstream
Sedona bugs (#2720, #2721, #2722).

Part of #2230.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds several GeoPandas-compatibility APIs to Sedona’s Spark-backed GeoSeries/GeoDataFrame, primarily by delegating to Sedona ST_* functions, plus accompanying unit/match tests to validate behavior.

Changes:

  • Implement GeoSeries.type, GeoSeries.m, GeoSeries.delaunay_triangles, GeoSeries.voronoi_polygons, GeoSeries.disjoint, and deprecated GeoSeries.unary_union.
  • Fix GeoDataFrame.type to delegate to geom_type.
  • Add/expand unit tests and GeoPandas match tests for the above APIs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
python/sedona/spark/geopandas/base.py Adds docstrings + delegates for type, delaunay_triangles, voronoi_polygons, unary_union, disjoint.
python/sedona/spark/geopandas/geoseries.py Implements Sedona-backed execution for type, delaunay_triangles, voronoi_polygons, unary_union, disjoint, m.
python/sedona/spark/geopandas/geodataframe.py Implements GeoDataFrame.type as alias to geom_type.
python/tests/geopandas/test_geoseries.py Adds unit tests for the new/updated GeoSeries behaviors.
python/tests/geopandas/test_match_geopandas_series.py Adds GeoPandas comparison tests (or non-comparison checks where semantics differ).

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

@jiayuasu jiayuasu added this to the sedona-1.9.0 milestone Mar 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

python/tests/geopandas/test_match_geopandas_series.py:26

  • The imports section now includes unused and duplicate imports: pyspark is never referenced in this module, and pyspark.pandas as ps is imported twice. Removing the unused pyspark import and the duplicate ps import will keep the test module clean and avoid lint failures.
import os
import shutil
import tempfile
import warnings
import pytest
import numpy as np
import pandas as pd
import geopandas as gpd
import pyspark.pandas as ps
import pyspark

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

@jbampton jbampton added python Pull requests that update Python code sedona-geopandas labels Mar 12, 2026
@jiayuasu jiayuasu requested a review from Copilot March 12, 2026 00:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code sedona-geopandas

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement GeoSeries: type, unary_union, delaunay_triangles, voronoi_polygons, disjoint, m

3 participants