Reputation: 11
Centroid in Geopandas
I have two location so I want get centroid from geopandas by python? How I do it?
Upvotes: 1
Views: 8484
Reputation: 10055
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
.
Upvotes: 9