geost.accessor.GeostFrame.to_crs#

GeostFrame.to_crs(crs: str | int | CRS) GeoDataFrame[source]#

Change the coordinate reference system (CRS) to a given target CRS.

Parameters:

crs (str | int | CRS) – EPSG of the target CRS. Takes anything that can be interpreted by pyproj.crs.CRS.from_user_input().

Examples

Change the horizontal reference to WGS 84 UTM zone 31N:

>>> new_gdf = gdf.gst.to_crs(32631)

This would be the same as:

>>> new_gdf = gdf.gst.to_crs("epsg:32631")

As Pyproj is very flexible, you can even use the CRS’s full official name:

>>> new_gdf = gdf.gst.to_crs("WGS 84 / UTM zone 31N")
Returns:

The GeoDataFrame with the CRS set to the target CRS.

Return type:

gpd.GeoDataFrame

Notes

The to_crs accessor method additionally transforms separate x and y columns, whereas using the to_crs method directly on the GeoDataFrame only transforms the geometry column. GeoDataframe crs property and set_crs should be accessed directly from the GeoDataFrame, as they do not have a custom implementation through the accessor.