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


##########
python/tests/geopandas/test_geoseries.py:
##########
@@ -1462,6 +1462,37 @@ def test_crosses(self):
         df_result = s.to_geoframe().crosses(s2, align=False).to_pandas()
         assert_series_equal(df_result, expected)
 
+    def test_geometry_type_with_m_dimension(self):

Review Comment:
   Personally, I think it's better to test each of the functions in their own 
respective test functions, rather than lump than all together. How about we 
remove this test and add tests to the existing `test_crosses`, `test_length`, 
and `test_boundary`? We can write slightly more precise tests and there's a 
small correctness bug in this one atm, anyways.



##########
python/tests/geopandas/test_geoseries.py:
##########
@@ -1462,6 +1462,37 @@ def test_crosses(self):
         df_result = s.to_geoframe().crosses(s2, align=False).to_pandas()
         assert_series_equal(df_result, expected)
 

Review Comment:
   ```suggestion
   
           # Sedona ST_Crosses doesn't support GeometryCollection, so it 
returns NULL for now.
           # https://github.com/apache/sedona/issues/2417
           # Once this is resolved, we can update this expected result of this 
test.
           # Ensure M-dimension doesn't break things.
           s = GeoSeries(
               [
                   wkt.loads("GEOMETRYCOLLECTION M (POINT M (1 2 3))"),
                   wkt.loads("LINESTRING M (0 0 1, 1 1 2)"),
               ]
           )
           line = LineString([(0, 0), (1, 1)])
           result = s.crosses(line)
           expected = pd.Series([None, False])
           assert_series_equal(result.to_pandas(), expected)
   
   ```
   
   I essentially copied the original test you had below to here (and made the 
expected results more precise). ST_Crosses is weird tbh, since it has a 
workaround. I filed https://github.com/apache/sedona/issues/2417 and mentioned 
it in the comments.



##########
python/tests/geopandas/test_geoseries.py:
##########


Review Comment:
   ```suggestion
   
           # Ensure M-dimension doesn't break things.
           s = GeoSeries(
               [
                   wkt.loads("GEOMETRYCOLLECTION M (POINT M (1 2 3))"),
               ]
           )
           result = s.boundary
           expected = gpd.GeoSeries(
               [
                   None,
               ]
           )
           self.check_sgpd_equals_gpd(result, expected)
   
   ```
   
   Again just replicating your test from below



##########
python/tests/geopandas/test_geoseries.py:
##########


Review Comment:
   ```suggestion
   
           s = GeoSeries(
               [
                   wkt.loads("POINT M (0 0 0)"),
                   wkt.loads("LINESTRING M (0 0 0, 1 1 0)"),
                   wkt.loads("POLYGON M ((0 0 0, 1 0 0, 1 1 0, 0 0 0))"),
                   wkt.loads(
                       "GEOMETRYCOLLECTION M (POINT M (0 0 0), LINESTRING M (0 
0 0, 1 1 0), POLYGON M ((0 0 0, 1 0 0, 1 1 0, 0 0 0)))"
                   ),
               ]
           )
           result = s.length.to_pandas()
           expected = pd.Series([0.000000, 1.414214, 3.414214, 4.828427])
           assert_series_equal(result, expected)
   
   ```
   
   For `.length()`, I played around with it locally and realize I'm not super 
confident about 3D support right now. I propose we simply take the existing 
`.length()` test and add a m-dimension of `0` to each of them, so that it's 
basically a 2d computation. Supporting / testing 3D support is out of scope for 
this PR.



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