Skip to content

[GH-2025] Geopandas.GeoSeries: Implement is_valid, is_empty, is_simple#2026

Merged
jiayuasu merged 4 commits into
apache:masterfrom
petern48:is_valid_series
Jul 2, 2025
Merged

[GH-2025] Geopandas.GeoSeries: Implement is_valid, is_empty, is_simple#2026
jiayuasu merged 4 commits into
apache:masterfrom
petern48:is_valid_series

Conversation

@petern48
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?

Implement is_valid and is_empty

How was this patch tested?

Added tests

Did this PR include necessary documentation updates?

  • Yes, I have updated the documentation.

@petern48 petern48 marked this pull request as ready for review June 30, 2025 15:05
@petern48 petern48 requested a review from jiayuasu as a code owner June 30, 2025 15:05
@petern48 petern48 requested a review from zhangfengcdt June 30, 2025 15:05
@petern48 petern48 changed the title [GH-2025] Geopandas.GeoSeries: Implement is_valid and is_empty [GH-2025] Geopandas.GeoSeries: Implement is_valid, is_empty, is_simple Jun 30, 2025
Copy link
Copy Markdown
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

Implements geometry validity, emptiness, and simplicity checks in GeoSeries, updates WKB conversion to handle None, and adds corresponding tests.

  • Implemented is_valid, is_empty, and is_simple by invoking respective Spark SQL functions.
  • Updated constructor to emit None for missing geometries when converting to WKB.
  • Expanded tests in test_match_geopandas_series.py and test_geoseries.py for the new properties and added LinearRing imports.

Reviewed Changes

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

File Description
python/tests/geopandas/test_match_geopandas_series.py Added loops testing .is_valid and .is_empty; imported LinearRing.
python/tests/geopandas/test_geoseries.py Expanded unit tests for .is_valid, .is_empty, .is_simple; added LinearRing import.
python/sedona/geopandas/geoseries.py Updated WKB conversion to handle None; implemented is_valid, is_empty, is_simple.
Comments suppressed due to low confidence (3)

python/sedona/geopandas/geoseries.py:347

  • [nitpick] In the docstring examples, import GeoSeries from sedona.geopandas rather than referencing geopandas.GeoSeries to avoid confusion.
        >>> from shapely.geometry import Polygon

python/tests/geopandas/test_match_geopandas_series.py:299

  • Wrap geom in a list when constructing GeoSeries (e.g., GeoSeries([geom])) so that it’s treated as a sequence rather than attempting to iterate over the geometry itself.
            sgpd_result = GeoSeries(geom).is_valid

python/tests/geopandas/test_match_geopandas_series.py:309

  • Wrap geom in a list when constructing GeoSeries (e.g., GeoSeries([geom])) so that it’s treated as a sequence rather than attempting to iterate over the geometry itself.
            sgpd_result = GeoSeries(geom).is_empty

Comment thread python/sedona/geopandas/geoseries.py
Comment thread python/sedona/geopandas/geoseries.py
Comment thread python/sedona/geopandas/geoseries.py
@jiayuasu jiayuasu merged commit 60436fe into apache:master Jul 2, 2025
26 checks passed
@petern48 petern48 deleted the is_valid_series branch July 2, 2025 22:03
Kontinuation pushed a commit to Kontinuation/sedona that referenced this pull request Jan 21, 2026
…_simple (apache#2026)

* Support elements of None type in GeoSeries

* Implement test_is_valid

* Implement is_empty

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Geopandas.GeoSeries: Implement is_valid, is_empty, is_simple

3 participants