Centroid in Geopandas
I have two location so I want get centroid from geopandas by python? How I do it?
Centroid in Geopandas
I have two location so I want get centroid from geopandas by python? How I do it?
You can use geopandas.GeoSeries.centroid
:
import geopandas as gpd
df = gpd.read_file("polygons.shp")
df["centroid"] = df["geometry"].centroid
df
See also shapely's documentation: object.centroid
.