You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2025/07/18 15:29:52 UTC

Re: [PR] [GH-2060] Geopandas.GeoSeries: Implement crosses, overlaps, touches, within, covers, covered_by, contains, distance [sedona]

Copilot commented on code in PR #2061:
URL: https://github.com/apache/sedona/pull/2061#discussion_r2216341527


##########
python/tests/geopandas/test_match_geopandas_series.py:
##########
@@ -700,8 +725,150 @@ def test_intersection(self):
     def test_intersection_all(self):
         pass
 
+    def test_overlaps(self):
+        for _, geom in self.geoms:
+            for _, geom2 in self.geoms:
+                # Sedona's results differ from geopandas for these cases
+                if geom == geom2 or self.contains_any_geom_collection(geom, geom2):
+                    continue
+
+                sgpd_result = GeoSeries(geom).overlaps(GeoSeries(geom2, align=True))
+                gpd_result = gpd.GeoSeries(geom).overlaps(
+                    gpd.GeoSeries(geom2), align=True
+                )
+                self.check_pd_series_equal(sgpd_result, gpd_result)
+
+                if len(geom) == len(geom2):
+                    sgpd_result = GeoSeries(geom).overlaps(
+                        GeoSeries(geom2), align=False
+                    )
+                    gpd_result = gpd.GeoSeries(geom).overlaps(
+                        gpd.GeoSeries(geom2), align=False
+                    )
+                    self.check_pd_series_equal(sgpd_result, gpd_result)
+
+    def test_touches(self):
+        for _, geom in self.geoms:
+            for _, geom2 in self.geoms:
+                if self.contains_any_geom_collection(geom, geom2):
+                    continue
+                sgpd_result = GeoSeries(geom).touches(GeoSeries(geom2), align=True)
+                gpd_result = gpd.GeoSeries(geom).touches(
+                    gpd.GeoSeries(geom2), align=True
+                )
+                self.check_pd_series_equal(sgpd_result, gpd_result)
+
+                if len(geom) == len(geom2):
+                    sgpd_result = GeoSeries(geom).touches(GeoSeries(geom2), align=False)
+                    gpd_result = gpd.GeoSeries(geom).touches(
+                        gpd.GeoSeries(geom2), align=False
+                    )
+                    self.check_pd_series_equal(sgpd_result, gpd_result)
+
+    def test_within(self):
+        for _, geom in self.geoms:
+            for _, geom2 in self.geoms:
+                if geom == geom2 or self.contains_any_geom_collection(geom, geom2):
+                    continue
+
+                sgpd_result = GeoSeries(geom).within(GeoSeries(geom2), align=True)
+                gpd_result = gpd.GeoSeries(geom).within(
+                    gpd.GeoSeries(geom2), align=True
+                )
+
+                self.check_pd_series_equal(sgpd_result, gpd_result)
+
+                if len(geom) == len(geom2):
+                    sgpd_result = GeoSeries(geom).within(GeoSeries(geom2), align=False)
+                    gpd_result = gpd.GeoSeries(geom).within(
+                        gpd.GeoSeries(geom2), align=False
+                    )
+                    self.check_pd_series_equal(sgpd_result, gpd_result)
+
+    def test_covers(self):
+        if parse_version(gpd.__version__) < parse_version("0.8.0"):
+            pytest.skip("geopandas < 0.8.0 does not support covered_by")
+
+        for _, geom in self.geoms:
+            for _, geom2 in self.geoms:
+                if geom == geom2 or self.contains_any_geom_collection(geom, geom2):
+                    continue
+
+                print(geom, geom2)
+                sgpd_result = GeoSeries(geom).covers(GeoSeries(geom2), align=True)

Review Comment:
   Debug print statement should be removed from production test code
   ```suggestion
                   sgpd_result = GeoSeries(geom).covers(GeoSeries(geom2), align=True)
   ```



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