petern48 commented on code in PR #2784:
URL: https://github.com/apache/sedona/pull/2784#discussion_r2995899853


##########
python/sedona/spark/geopandas/base.py:
##########
@@ -3073,6 +3049,55 @@ def dwithin(self, other, distance, align=None):
         """
         return _delegate_to_geometry_column("dwithin", self, other, distance, 
align)
 
+    def clip_by_rect(self, xmin, ymin, xmax, ymax):
+        """Returns a ``GeoSeries`` of the portions of geometry within the
+        given rectangle.
+
+        The geometry is clipped to the rectangle defined by the given
+        coordinates.  Geometries that do not intersect the rectangle are
+        returned as empty geometry collections.
+
+        Parameters
+        ----------
+        xmin : float
+            Minimum x value of the rectangle.
+        ymin : float
+            Minimum y value of the rectangle.
+        xmax : float
+            Maximum x value of the rectangle.
+        ymax : float
+            Maximum y value of the rectangle.
+
+        Returns
+        -------
+        GeoSeries
+
+        Examples
+        --------
+        >>> from sedona.spark.geopandas import GeoSeries
+        >>> from shapely.geometry import Polygon, LineString, Point
+        >>> s = GeoSeries(
+        ...     [
+        ...         Polygon([(0, 0), (2, 0), (2, 2), (0, 2)]),
+        ...         LineString([(0, 0), (2, 2)]),
+        ...         Point(1, 1),

Review Comment:
   Note to self, assuming the docstring is correct, it looks like our behavior 
differs from geopandas. Their doc says the result for `POINT (0 1)` is GeomCol 
Empty, while we say it's `Point (0 1)` (which makes more sense to me tbh). We 
need to investigate this before moving forward (i.e., verify that those are the 
actual results, and then figure out what to do from there).



-- 
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