jiayuasu commented on code in PR #2014:
URL: https://github.com/apache/sedona/pull/2014#discussion_r2175592227


##########
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:
   Note that `to_pandas()` function will collect the distributed Sedona DF to 
the master node. This will likely cause OOM on the master. The best way to do 
this is via Spark's `take()` which only takes the first value of the 
distributed DF without collecting the entire DF.
   
   In addition, this function assumes all records in the DF has the same 
CRS/SRID which is not true for Sedona in many cases. It is worth mentioning 
this in the docs.



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