This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git
The following commit(s) were added to refs/heads/master by this push:
new 7c4416f300 [GH-2018] Geopandas.GeoSeries: Setup skeleton of functions
and tests (#2019)
7c4416f300 is described below
commit 7c4416f300186be69b0ff2a3e57d4227f1d9d2d4
Author: Peter Nguyen <[email protected]>
AuthorDate: Sat Jun 28 11:36:38 2025 -0700
[GH-2018] Geopandas.GeoSeries: Setup skeleton of functions and tests (#2019)
* Add skeleton of functions and tests
* Add more tests from the existing skeleton from above
---
python/sedona/geopandas/geoseries.py | 123 ++++++++++++
python/tests/geopandas/test_geoseries.py | 220 +++++++++++++++++++++
.../tests/geopandas/test_match_geopandas_series.py | 220 +++++++++++++++++++++
3 files changed, 563 insertions(+)
diff --git a/python/sedona/geopandas/geoseries.py
b/python/sedona/geopandas/geoseries.py
index b9b914aa45..192dad6e24 100644
--- a/python/sedona/geopandas/geoseries.py
+++ b/python/sedona/geopandas/geoseries.py
@@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.
+import os
+import typing
from typing import Any, Union
import geopandas as gpd
@@ -616,6 +618,127 @@ class GeoSeries(GeoFrame, pspd.Series):
**kwargs,
)
+ @property
+ def geometry(self) -> "GeoSeries":
+ return self
+
+ @property
+ def x(self) -> pspd.Series:
+ raise NotImplementedError("GeoSeries.x() is not implemented yet.")
+
+ @property
+ def y(self) -> pspd.Series:
+ raise NotImplementedError("GeoSeries.y() is not implemented yet.")
+
+ @property
+ def z(self) -> pspd.Series:
+ raise NotImplementedError("GeoSeries.z() is not implemented yet.")
+
+ @property
+ def m(self) -> pspd.Series:
+ raise NotImplementedError("GeoSeries.m() is not implemented yet.")
+
+ @classmethod
+ def from_file(
+ cls, filename: Union[os.PathLike, typing.IO], **kwargs
+ ) -> "GeoSeries":
+ raise NotImplementedError("GeoSeries.from_file() is not implemented
yet.")
+
+ @classmethod
+ def from_wkb(
+ cls,
+ data,
+ index=None,
+ crs: Union[Any, None] = None,
+ on_invalid="raise",
+ **kwargs,
+ ) -> "GeoSeries":
+ raise NotImplementedError("GeoSeries.from_wkb() is not implemented
yet.")
+
+ @classmethod
+ def from_wkt(
+ cls,
+ data,
+ index=None,
+ crs: Union[Any, None] = None,
+ on_invalid="raise",
+ **kwargs,
+ ) -> "GeoSeries":
+ raise NotImplementedError("GeoSeries.from_wkt() is not implemented
yet.")
+
+ @classmethod
+ def from_xy(cls, x, y, z=None, index=None, crs=None, **kwargs) ->
"GeoSeries":
+ raise NotImplementedError("GeoSeries.from_xy() is not implemented
yet.")
+
+ @classmethod
+ def from_shapely(
+ cls, data, index=None, crs: Union[Any, None] = None, **kwargs
+ ) -> "GeoSeries":
+ raise NotImplementedError("GeoSeries.from_shapely() is not implemented
yet.")
+
+ @classmethod
+ def from_arrow(cls, arr, **kwargs) -> "GeoSeries":
+ raise NotImplementedError("GeoSeries.from_arrow() is not implemented
yet.")
+
+ def to_file(
+ self,
+ filename: Union[os.PathLike, typing.IO],
+ driver: Union[str, None] = None,
+ index: Union[bool, None] = None,
+ **kwargs,
+ ):
+ raise NotImplementedError("GeoSeries.to_file() is not implemented
yet.")
+
+ def isna(self) -> pspd.Series:
+ raise NotImplementedError("GeoSeries.isna() is not implemented yet.")
+
+ def isnull(self) -> pspd.Series:
+ raise NotImplementedError("GeoSeries.isnull() is not implemented yet.")
+
+ def notna(self) -> pspd.Series:
+ raise NotImplementedError("GeoSeries.notna() is not implemented yet.")
+
+ def notnull(self) -> pspd.Series:
+ """Alias for `notna` method. See `notna` for more detail."""
+ return self.notna()
+
+ def fillna(self, value: Any) -> "GeoSeries":
+ raise NotImplementedError("GeoSeries.fillna() is not implemented yet.")
+
+ def explode(self, ignore_index=False, index_parts=False) -> "GeoSeries":
+ raise NotImplementedError("GeoSeries.explode() is not implemented
yet.")
+
+ def to_crs(
+ self, crs: Union[Any, None] = None, epsg: Union[int, None] = None
+ ) -> "GeoSeries":
+ raise NotImplementedError("GeoSeries.to_crs() is not implemented yet.")
+
+ def estimate_utm_crs(self, datum_name: str = "WGS 84"):
+ raise NotImplementedError(
+ "GeoSeries.estimate_utm_crs() is not implemented yet."
+ )
+
+ def to_json(
+ self,
+ show_bbox: bool = True,
+ drop_id: bool = False,
+ to_wgs84: bool = False,
+ **kwargs,
+ ) -> str:
+ raise NotImplementedError("GeoSeries.to_json() is not implemented
yet.")
+
+ def to_wkb(self, hex: bool = False, **kwargs) -> pspd.Series:
+ raise NotImplementedError("GeoSeries.to_wkb() is not implemented yet.")
+
+ def to_wkt(self, **kwargs) -> pspd.Series:
+ raise NotImplementedError("GeoSeries.to_wkt() is not implemented yet.")
+
+ def to_arrow(self, geometry_encoding="WKB", interleaved=True,
include_z=None):
+ raise NotImplementedError("GeoSeries.to_arrow() is not implemented
yet.")
+
+ def clip(self, mask, keep_geom_type: bool = False, sort=False) ->
"GeoSeries":
+ raise NotImplementedError("GeoSeries.clip() is not implemented yet.")
+
#
-----------------------------------------------------------------------------
# # Utils
#
-----------------------------------------------------------------------------
diff --git a/python/tests/geopandas/test_geoseries.py
b/python/tests/geopandas/test_geoseries.py
index bec526ad46..65688b6ae8 100644
--- a/python/tests/geopandas/test_geoseries.py
+++ b/python/tests/geopandas/test_geoseries.py
@@ -66,3 +66,223 @@ class TestGeoSeries(TestBase):
expected = gpd.GeoSeries([wkt.loads(wkt_str) for wkt_str in expected])
assert result.count() > 0
self.check_sgpd_equals_gpd(result, expected)
+
+ def test_geometry(self):
+ sgpd_geoseries = sgpd.GeoSeries([Point(0, 0), Point(1, 1)])
+ assert isinstance(sgpd_geoseries.geometry, sgpd.GeoSeries)
+ assert_series_equal(
+ sgpd_geoseries.geometry.to_pandas(), sgpd_geoseries.to_pandas()
+ )
+
+ def test_x(self):
+ pass
+
+ def test_y(self):
+ pass
+
+ def test_z(self):
+ pass
+
+ def test_m(self):
+ pass
+
+ def test_from_file(self):
+ pass
+
+ def test_from_wkb(self):
+ pass
+
+ def test_from_wkt(self):
+ pass
+
+ def test_from_xy(self):
+ pass
+
+ def test_from_shapely(self):
+ pass
+
+ def test_from_arrow(self):
+ pass
+
+ def test_to_file(self):
+ pass
+
+ def test_isna(self):
+ pass
+
+ def test_isnull(self):
+ pass
+
+ def test_notna(self):
+ pass
+
+ def test_notnull(self):
+ pass
+
+ def test_fillna(self):
+ pass
+
+ def test_explode(self):
+ pass
+
+ def test_to_crs(self):
+ pass
+
+ def test_estimate_utm_crs(self):
+ pass
+
+ def test_to_json(self):
+ pass
+
+ def test_to_wkb(self):
+ pass
+
+ def test_to_wkt(self):
+ pass
+
+ def test_to_arrow(self):
+ pass
+
+ def test_clip(self):
+ pass
+
+ def test_geom_type(self):
+ pass
+
+ def test_type(self):
+ pass
+
+ def test_length(self):
+ pass
+
+ def test_is_valid(self):
+ pass
+
+ def test_is_valid_reason(self):
+ pass
+
+ def test_is_empty(self):
+ pass
+
+ def test_count_coordinates(self):
+ pass
+
+ def test_count_geometries(self):
+ pass
+
+ def test_count_interior_rings(self):
+ pass
+
+ def test_is_simple(self):
+ pass
+
+ def test_is_ring(self):
+ pass
+
+ def test_is_ccw(self):
+ pass
+
+ def test_is_closed(self):
+ pass
+
+ def test_has_z(self):
+ pass
+
+ def test_get_precision(self):
+ pass
+
+ def test_get_geometry(self):
+ pass
+
+ def test_boundary(self):
+ pass
+
+ def test_centroid(self):
+ pass
+
+ def test_concave_hull(self):
+ pass
+
+ def test_convex_hull(self):
+ pass
+
+ def test_delaunay_triangles(self):
+ pass
+
+ def test_voronoi_polygons(self):
+ pass
+
+ def test_envelope(self):
+ pass
+
+ def test_minimum_rotated_rectangle(self):
+ pass
+
+ def test_exterior(self):
+ pass
+
+ def test_extract_unique_points(self):
+ pass
+
+ def test_offset_curve(self):
+ pass
+
+ def test_interiors(self):
+ pass
+
+ def test_remove_repeated_points(self):
+ pass
+
+ def test_set_precision(self):
+ pass
+
+ def test_representative_point(self):
+ pass
+
+ def test_minimum_bounding_circle(self):
+ pass
+
+ def test_minimum_bounding_radius(self):
+ pass
+
+ def test_minimum_clearance(self):
+ pass
+
+ def test_normalize(self):
+ pass
+
+ def test_make_valid(self):
+ pass
+
+ def test_reverse(self):
+ pass
+
+ def test_segmentize(self):
+ pass
+
+ def test_transform(self):
+ pass
+
+ def test_force_2d(self):
+ pass
+
+ def test_force_3d(self):
+ pass
+
+ def test_line_merge(self):
+ pass
+
+ def test_unary_union(self):
+ pass
+
+ def test_union_all(self):
+ pass
+
+ def test_intersection_all(self):
+ pass
+
+ def test_contains(self):
+ pass
+
+ def test_contains_properly(self):
+ pass
diff --git a/python/tests/geopandas/test_match_geopandas_series.py
b/python/tests/geopandas/test_match_geopandas_series.py
index 3b3eccc4d4..7034e659d8 100644
--- a/python/tests/geopandas/test_match_geopandas_series.py
+++ b/python/tests/geopandas/test_match_geopandas_series.py
@@ -205,6 +205,226 @@ class TestMatchGeopandasSeries(TestBase):
self.g1.buffer(0.2).to_parquet(temp_file_path)
assert os.path.exists(temp_file_path)
+ def test_geometry(self):
+ for _, geom in self.geoms:
+ gpd_result = gpd.GeoSeries(geom).geometry
+ sgpd_result = GeoSeries(geom).geometry
+ assert isinstance(sgpd_result, GeoSeries)
+ self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+
+ def test_x(self):
+ pass
+
+ def test_y(self):
+ pass
+
+ def test_z(self):
+ pass
+
+ def test_m(self):
+ pass
+
+ def test_from_file(self):
+ pass
+
+ def test_from_wkb(self):
+ pass
+
+ def test_from_wkt(self):
+ pass
+
+ def test_from_xy(self):
+ pass
+
+ def test_from_shapely(self):
+ pass
+
+ def test_from_arrow(self):
+ pass
+
+ def test_to_file(self):
+ pass
+
+ def test_isna(self):
+ pass
+
+ def test_isnull(self):
+ pass
+
+ def test_notna(self):
+ pass
+
+ def test_notnull(self):
+ pass
+
+ def test_fillna(self):
+ pass
+
+ def test_explode(self):
+ pass
+
+ def test_to_crs(self):
+ pass
+
+ def test_estimate_utm_crs(self):
+ pass
+
+ def test_to_json(self):
+ pass
+
+ def test_to_wkb(self):
+ pass
+
+ def test_to_wkt(self):
+ pass
+
+ def test_to_arrow(self):
+ pass
+
+ def test_clip(self):
+ pass
+
+ def test_geom_type(self):
+ pass
+
+ def test_type(self):
+ pass
+
+ def test_length(self):
+ pass
+
+ def test_is_valid(self):
+ pass
+
+ def test_is_valid_reason(self):
+ pass
+
+ def test_is_empty(self):
+ pass
+
+ def test_count_coordinates(self):
+ pass
+
+ def test_count_geometries(self):
+ pass
+
+ def test_count_interior_rings(self):
+ pass
+
+ def test_is_simple(self):
+ pass
+
+ def test_is_ring(self):
+ pass
+
+ def test_is_ccw(self):
+ pass
+
+ def test_is_closed(self):
+ pass
+
+ def test_has_z(self):
+ pass
+
+ def test_get_precision(self):
+ pass
+
+ def test_get_geometry(self):
+ pass
+
+ def test_boundary(self):
+ pass
+
+ def test_centroid(self):
+ pass
+
+ def test_concave_hull(self):
+ pass
+
+ def test_convex_hull(self):
+ pass
+
+ def test_delaunay_triangles(self):
+ pass
+
+ def test_voronoi_polygons(self):
+ pass
+
+ def test_envelope(self):
+ pass
+
+ def test_minimum_rotated_rectangle(self):
+ pass
+
+ def test_exterior(self):
+ pass
+
+ def test_extract_unique_points(self):
+ pass
+
+ def test_offset_curve(self):
+ pass
+
+ def test_interiors(self):
+ pass
+
+ def test_remove_repeated_points(self):
+ pass
+
+ def test_set_precision(self):
+ pass
+
+ def test_representative_point(self):
+ pass
+
+ def test_minimum_bounding_circle(self):
+ pass
+
+ def test_minimum_bounding_radius(self):
+ pass
+
+ def test_minimum_clearance(self):
+ pass
+
+ def test_normalize(self):
+ pass
+
+ def test_make_valid(self):
+ pass
+
+ def test_reverse(self):
+ pass
+
+ def test_segmentize(self):
+ pass
+
+ def test_transform(self):
+ pass
+
+ def test_force_2d(self):
+ pass
+
+ def test_force_3d(self):
+ pass
+
+ def test_line_merge(self):
+ pass
+
+ def test_unary_union(self):
+ pass
+
+ def test_union_all(self):
+ pass
+
+ def test_intersection_all(self):
+ pass
+
+ def test_contains(self):
+ pass
+
+ def test_contains_properly(self):
+ pass
+
#
-----------------------------------------------------------------------------
# # Utils
#
-----------------------------------------------------------------------------