From 4c74f37bc4655868e3477b5923df6fa6e53ea8ef Mon Sep 17 00:00:00 2001 From: Kelsey Jordahl Date: Thu, 27 Jun 2013 07:41:15 -0500 Subject: [PATCH] centroid property --- geopandas/geoseries.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/geopandas/geoseries.py b/geopandas/geoseries.py index 447dd55..0a564bd 100644 --- a/geopandas/geoseries.py +++ b/geopandas/geoseries.py @@ -79,6 +79,13 @@ class GeoSeries(Series): columns=['minx', 'miny', 'maxx', 'maxy'], index=self.index) + @property + def centroid(self): + """ + Return the centroid of each geometry in the GeoSeries + """ + return GeoSeries([geom.centroid for geom in self], index=self.index) + @property def geom_type(self): return Series([geom.geom_type for geom in self], index=self.index)