GeoDataFrame.set_crs(value, allow_override=False)#

Set the Coordinate Reference System (CRS) of a GeoSeries.

This docstring was copied from geopandas.geoseries.GeoSeries.set_crs.

Some inconsistencies with the Dask version may exist.

Set the value of the crs on a new object

NOTE: The underlying geometries are not transformed to this CRS. To transform the geometries to a new CRS, use the to_crs method.

crspyproj.CRS, optional if epsg is specified (Not supported in Dask)

The value can be anything accepted by pyproj.CRS.from_user_input(), such as an authority string (eg “EPSG:4326”) or a WKT string.

epsgint, optional if crs is specified (Not supported in Dask)

EPSG code specifying the projection.

inplacebool, default False (Not supported in Dask)

If True, the CRS of the GeoSeries will be changed in place (while still returning the result) instead of making a copy of the GeoSeries.

allow_overridebool, default False

If the the GeoSeries already has a CRS, allow to replace the existing CRS, even when both are not equal.


See also


re-project to another CRS


>>> from shapely.geometry import Point  
>>> s = geopandas.GeoSeries([Point(1, 1), Point(2, 2), Point(3, 3)])  
>>> s  
0    POINT (1.00000 1.00000)
1    POINT (2.00000 2.00000)
2    POINT (3.00000 3.00000)
dtype: geometry

Setting CRS to a GeoSeries without one:

>>> s.crs is None  
>>> s = s.set_crs('epsg:3857')  
>>> s.crs  
<Projected CRS: EPSG:3857>
Name: WGS 84 / Pseudo-Mercator
Axis Info [cartesian]:
- X[east]: Easting (metre)
- Y[north]: Northing (metre)
Area of Use:
- name: World - 85°S to 85°N
- bounds: (-180.0, -85.06, 180.0, 85.06)
Coordinate Operation:
- name: Popular Visualisation Pseudo-Mercator
- method: Popular Visualisation Pseudo Mercator
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich

Overriding existing CRS:

>>> s = s.set_crs(4326, allow_override=True)  

Without allow_override=True, set_crs returns an error if you try to override CRS.