You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "jiayuasu (via GitHub)" <gi...@apache.org> on 2025/07/10 19:44:59 UTC
Re: [PR] [GH-2070] Geopandas.GeoSeries: Implement `get_geometry` [sedona]
jiayuasu commented on code in PR #2071:
URL: https://github.com/apache/sedona/pull/2071#discussion_r2198575806
##########
python/sedona/geopandas/geoseries.py:
##########
@@ -829,9 +829,78 @@ def get_precision(self):
# Implementation of the abstract method
raise NotImplementedError("This method is not implemented yet.")
- def get_geometry(self, index):
- # Implementation of the abstract method
- raise NotImplementedError("This method is not implemented yet.")
+ def get_geometry(self, index) -> "GeoSeries":
+ """Returns the n-th geometry from a collection of geometries.
+
+ Parameters
+ ----------
+ index : int or array_like
+ Position of a geometry to be retrieved within its collection
+
+ Returns
+ -------
+ GeoSeries
+
+ Notes
+ -----
+ Simple geometries act as collections of length 1. Any out-of-range index value
+ returns None.
+
+ Examples
+ --------
+ >>> from shapely.geometry import Point, MultiPoint, GeometryCollection
+ >>> s = geopandas.GeoSeries(
+ ... [
Review Comment:
How about POLYGON WKT?
##########
python/sedona/geopandas/geoseries.py:
##########
@@ -829,9 +829,78 @@ def get_precision(self):
# Implementation of the abstract method
raise NotImplementedError("This method is not implemented yet.")
- def get_geometry(self, index):
- # Implementation of the abstract method
- raise NotImplementedError("This method is not implemented yet.")
+ def get_geometry(self, index) -> "GeoSeries":
+ """Returns the n-th geometry from a collection of geometries.
+
+ Parameters
+ ----------
+ index : int or array_like
+ Position of a geometry to be retrieved within its collection
+
+ Returns
+ -------
+ GeoSeries
+
+ Notes
+ -----
+ Simple geometries act as collections of length 1. Any out-of-range index value
+ returns None.
+
+ Examples
+ --------
+ >>> from shapely.geometry import Point, MultiPoint, GeometryCollection
+ >>> s = geopandas.GeoSeries(
+ ... [
Review Comment:
How about POLYGON EMPTY?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org