Conversation
…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.
There was a problem hiding this comment.
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 deprecatedGeoSeries.unary_union. - Fix
GeoDataFrame.typeto delegate togeom_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.
There was a problem hiding this comment.
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:
pysparkis never referenced in this module, andpyspark.pandas as psis imported twice. Removing the unusedpysparkimport and the duplicatepsimport 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.
There was a problem hiding this comment.
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.
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Closes Implement GeoSeries: type, unary_union, delaunay_triangles, voronoi_polygons, disjoint, m #2725What changes were proposed in this PR?
Implement 6 GeoSeries functions for the geopandas compatibility module:
General methods and attributes:
type(property) — alias forgeom_type, returns geometry type names as a Seriesm(property) ->ST_M— returns the M coordinate of point geometriesConstructive methods:
delaunay_triangles(tolerance, only_edges)->ST_DelaunayTrianglesvoronoi_polygons(tolerance, extend_to, only_edges)->ST_VoronoiPolygonsBinary predicates:
disjoint(other, align)->ST_DisjointAggregation:
unary_union(property) — deprecated, delegates tounion_all()withFutureWarningAlso fixes
GeoDataFrame.typeto delegate togeom_typeinstead of raisingNotImplementedError.Each function follows the established pattern from #2701 and #2710:
_delegate_to_geometry_columncall_query_geometry_columnor_row_wise_operationSemantic differences documented:
delaunay_trianglesandvoronoi_polygonsoperate per row (each input geometry produces aGeometryCollection), 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):
geom_equals— ST_Equals throws IllegalArgumentException on GeometryCollection inputs #2722 (ST_Equalscrashes onGeometryCollectioninputs)frechet_distance— ST_FrechetDistance returns 0.0 instead of null for empty geometries #2720 (ST_FrechetDistancereturns 0.0 for empty geometries)hausdorff_distance— ST_HausdorffDistance returns 0.0 instead of null for empty geometries #2721 (ST_HausdorffDistancereturns 0.0 for empty geometries)How was this patch tested?
12 new tests (6 unit tests + 6 match tests) all passing locally.
Did this PR include necessary documentation updates?