Skip to main content
Set the GeoDataFrame geometry using either an existing column or the specified input. By default yields a new object. The original geometry column is replaced with the input.

Signature

Parameters

column label or array-like
required
An existing column name or values to set as the new geometry column. If values (array-like, (Geo)Series) are passed, then if they are named (Series) the new geometry column will have the corresponding name, otherwise the existing geometry column will be replaced. If there is no existing geometry column, the new geometry column will use the default name “geometry”.
bool | None
default:"None"
When specifying a named Series or an existing column name for col, controls if the previous geometry column should be dropped from the result. The default of False keeps both the old and new geometry column.
Deprecated since version 1.0.0.
bool
default:"False"
Modify the GeoDataFrame in place (do not create a new object)
Any | None
default:"None"
Coordinate system to use. 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. If passed, overrides both DataFrame and col’s crs. Otherwise, tries to get crs from passed col values or DataFrame.

Returns

GeoDataFrame
See also
  • GeoDataFrame.rename_geometry: rename an active geometry column

Examples

Passing an array:
Using existing column: