chay0112 commented on code in PR #2484:
URL: https://github.com/apache/sedona/pull/2484#discussion_r2508873369


##########
python/sedona/spark/geopandas/base.py:
##########
@@ -611,9 +611,42 @@ def centroid(self):
     # def concave_hull(self, ratio=0.0, allow_holes=False):
     #     raise NotImplementedError("This method is not implemented yet.")
 
-    # @property
-    # def convex_hull(self):
-    #     raise NotImplementedError("This method is not implemented yet.")
+    @property
+    def convex_hull(self):
+        """
+        Return the convex hull of each geometry.
+
+        The convex hull is the smallest convex Polygon that contains
+        all the points of the geometry.
+
+        Examples
+        --------
+        >>> from shapely.geometry import Point, Polygon, LineString
+        >>> from sedona.spark.geopandas import GeoSeries
+        >>> s = GeoSeries(
+        ...     [
+        ...         Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]),
+        ...         LineString([(0, 0), (2, 1)]),
+        ...         Point(0, 0),
+        ...     ]
+        ... )
+        >>> s
+        0    POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))
+        1    LINESTRING (0 0, 2 1)
+        2                       POINT (0 0)
+        dtype: geometry
+
+        >>> s.convex_hull
+        0    POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))
+        1    POLYGON ((0 0, 2 1, 0 0))
+        2                       POINT (0 0)

Review Comment:
   Thanks for pointing this out as well ! Just addressed this one !



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to