petern48 commented on code in PR #2014:
URL: https://github.com/apache/sedona/pull/2014#discussion_r2175723508
##########
python/sedona/geopandas/geoseries.py:
##########
@@ -17,10 +17,11 @@
import os
import typing
-from typing import Any, Union
+from typing import Any, Union, Literal
import geopandas as gpd
Review Comment:
In the original geopandas implementation, they conditionally use/import
pyproj, so I followed the same logic. It's not needed in anything other than
the CRS functions.
```
def set_crs()
....
from pyproj import CRS
```
https://github.com/geopandas/geopandas/blob/e9b58ce57a238b28ebf5eddd83d437db92c314b5/geopandas/geoseries.py#L1153
##########
python/sedona/geopandas/geoseries.py:
##########
@@ -155,6 +162,176 @@ def __init__(
fastpath=fastpath,
)
+ if crs:
+ self.set_crs(crs, inplace=True)
+
+ @property
+ def crs(self) -> Union[CRS, None]:
+ """The Coordinate Reference System (CRS) as a ``pyproj.CRS`` object.
+
+ Returns None if the CRS is not set, and to set the value it
+ :getter: Returns a ``pyproj.CRS`` or None. When setting, the value
+ can be anything accepted by
+ :meth:`pyproj.CRS.from_user_input() <pyproj.crs.CRS.from_user_input>`,
+ such as an authority string (eg "EPSG:4326") or a WKT string.
+
+ Examples
+ --------
+ >>> s.crs # doctest: +SKIP
+ <Geographic 2D CRS: EPSG:4326>
+ Name: WGS 84
+ Axis Info [ellipsoidal]:
+ - Lat[north]: Geodetic latitude (degree)
+ - Lon[east]: Geodetic longitude (degree)
+ Area of Use:
+ - name: World
+ - bounds: (-180.0, -90.0, 180.0, 90.0)
+ Datum: World Geodetic System 1984
+ - Ellipsoid: WGS 84
+ - Prime Meridian: Greenwich
+
+ See Also
+ --------
+ GeoSeries.set_crs : assign CRS
+ GeoSeries.to_crs : re-project to another CRS
+ """
+ tmp_df = self._process_geometry_column("ST_SRID", rename="crs")
+ srid = tmp_df.to_pandas().iloc[0]
Review Comment:
Thanks. Yeah I remember realizing that, but I forgot to circle back to
figure out how to remove the to_pandas.
Also added the doc change. Slight nit about your wording: all CRS have to be
the same in the Series, not the DF. Different series are still allowed to have
different CRS in geopandas.
--
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]