Skip to main content
Set the Coordinate Reference System (CRS) of the GeoDataFrame. If there are multiple geometry columns within the GeoDataFrame, only the CRS of the active geometry column is set. Pass None to remove CRS from the active geometry column.

Signature

Parameters

Any | None
default:"None"
The value can be anything accepted by pyproj.CRS.from_user_input() <pyproj.crs.CRS.from_user_input>, such as an authority string (eg “EPSG:4326”) or a WKT string.
int | None
default:"None"
EPSG code specifying the projection.
bool
default:"False"
If True, the CRS of the GeoDataFrame will be changed in place (while still returning the result) instead of making a copy of the GeoDataFrame.
bool
default:"False"
If the GeoDataFrame already has a CRS, allow to replace the existing CRS, even when both are not equal. Validation uses column metadata when available. Without it, validation performs a distributed lookup of the first non-null geometry’s SRID.

Returns

GeoDataFrame
A new GeoDataFrame unless inplace=True, in which case the mutated original is returned.
The underlying geometries are not transformed to this CRS. To transform the geometries to a new CRS, use the to_crs method.A boolean second positional argument is interpreted as inplace for compatibility with the former Sedona signature. This form is deprecated; use keyword arguments instead.
See also
  • GeoDataFrame.to_crs: re-project to another CRS

Examples

Setting CRS to a GeoDataFrame without one:
Overriding existing CRS:
Without allow_override=True, set_crs returns an error if you try to override CRS.