> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GeoDataFrame.set_crs

> Set the Coordinate Reference System (CRS) of the GeoDataFrame.

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

```python theme={"system"}
set_crs(
    crs: Any | None = None,
    epsg: int | None = None,
    inplace: bool = False,
    allow_override: bool = False,
) -> GeoDataFrame
```

## Parameters

<ParamField path="crs" type="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.
</ParamField>

<ParamField path="epsg" type="int | None" default="None">
  EPSG code specifying the projection.
</ParamField>

<ParamField path="inplace" type="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.
</ParamField>

<ParamField path="allow_override" type="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.
</ParamField>

## Returns

<ResponseField name="return" type="GeoDataFrame">
  A new GeoDataFrame unless `inplace=True`, in which case the
  mutated original is returned.
</ResponseField>

<Note>
  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.
</Note>

**See also**

* `GeoDataFrame.to_crs`: re-project to another CRS

## Examples

```python theme={"system"}
>>> from sedona.spark.geopandas import GeoDataFrame
>>> from shapely.geometry import Point
>>> d = {'col1': ['name1', 'name2'], 'geometry': [Point(1, 2), Point(2, 1)]}
>>> gdf = GeoDataFrame(d)
>>> gdf
    col1     geometry
0  name1  POINT (1 2)
1  name2  POINT (2 1)
```

Setting CRS to a GeoDataFrame without one:

```python theme={"system"}
>>> gdf.crs is None
True
```

```python theme={"system"}
>>> gdf = gdf.set_crs('epsg:3857')
>>> gdf.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:

```python theme={"system"}
>>> gdf = gdf.set_crs(4326, allow_override=True)
```

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.