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


##########
python/sedona/geopandas/geoseries.py:
##########
@@ -2283,14 +2347,34 @@ def get_first_geometry_column(self) -> Union[str, None]:
             ),
             None,
         )
-        return first_binary_or_geometry_col
+        if first_binary_or_geometry_col:
+            return first_binary_or_geometry_col
+
+        raise ValueError(
+            "get_first_geometry_column: No geometry column found in the 
GeoSeries."
+        )
 
 
 # -----------------------------------------------------------------------------
 # # Utils
 # -----------------------------------------------------------------------------
 
 
+def _to_spark_pandas_df(ps_series: pspd.Series) -> pspd.DataFrame:
+    return pspd.DataFrame(ps_series._psdf._internal)
+
+
+def to_bool(ps_series: pspd.Series, default: bool = False) -> pspd.Series:
+    """
+    Cast a ps.Series to bool type if it's not one, converting None values to 
the default value.
+    """
+    if ps_series.dtype.name != "bool":
+        # fill None values with the default value
+        ps_series.fillna(default, inplace=True)
+

Review Comment:
   The `to_bool` helper fills missing values but never casts the series to 
boolean dtype. Add `ps_series = ps_series.astype('bool')` before returning to 
ensure a consistent boolean Series.
   ```suggestion
   
       ps_series = ps_series.astype('bool')
   ```



##########
python/sedona/geopandas/geoseries.py:
##########
@@ -117,6 +117,23 @@ def __init__(
         self._anchor: GeoDataFrame
         self._col_label: Label
 
+        def try_geom_to_ewkb(x) -> bytes:
+            if isinstance(x, BaseGeometry):
+                kwargs = {}
+                if crs:
+                    from pyproj import CRS
+
+                    srid = CRS.from_user_input(crs)
+                    kwargs["srid"] = srid.to_epsg()
+
+                return shapely.wkb.dumps(x, *kwargs)

Review Comment:
   The call to `shapely.wkb.dumps` is unpacking `kwargs` as positional 
arguments (`*kwargs`), which will pass only the keys. It should be unpacked as 
keyword arguments (`**kwargs`) to pass `srid` correctly.
   ```suggestion
                   return shapely.wkb.dumps(x, **kwargs)
   ```



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