piyushka-ally commented on code in PR #2784:
URL: https://github.com/apache/sedona/pull/2784#discussion_r3019785987


##########
python/tests/geopandas/test_match_geopandas_series.py:
##########
@@ -495,6 +495,27 @@ def test_to_arrow(self):
     def test_clip(self):
         pass
 
+    def test_clip_by_rect(self):
+        # Use rect (0.3, 0.3, 1.7, 1.7) so no test-geometry vertex or hole
+        # coordinate (0, 0.1, 0.2, 1, 2, …) lands on a rectangle boundary.
+        # This avoids boundary-handling differences between JTS and GEOS.
+        for geom in self.geoms:
+            # Sedona converts LinearRing to LineString, so geometry types
+            # will differ from geopandas results.
+            if isinstance(geom[0], LinearRing):
+                continue
+            # ST_Intersection returns different results for
+            # GeometryCollection inputs compared to GEOS clip_by_rect.
+            if isinstance(geom[0], GeometryCollection):
+                continue

Review Comment:
   Good call, the GeometryCollection skip was indeed added without verifying a 
specific failure case. I've removed it in the latest push and confirmed tests 
still pass.
   
   However, the is_valid check is needed; without it, JTS throws a 
TopologyException on self-intersecting polygons in the test fixtures (e.g. 
POLYGON ((0 0, 1 0, 2 1, 3 1, 0 0)) intersected with the clip rect). GEOS 
handles these gracefully, but JTS's overlay operation does not. I've updated 
the comment to explain this specific root cause. 



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