geopandas.GeoSeries.centroid#
- property GeoSeries.centroid#
返回一个
GeoSeries
表示每个几何体的质心的点。请注意,质心不必位于原始几何图形上或位于原始几何图形内。
参见
GeoSeries.representative_point
保证位于每个几何图形内的点
示例
>>> from shapely.geometry import Polygon, LineString, Point >>> s = geopandas.GeoSeries( ... [ ... Polygon([(0, 0), (1, 1), (0, 1)]), ... LineString([(0, 0), (1, 1), (1, 0)]), ... Point(0, 0), ... ] ... ) >>> s 0 POLYGON ((0.00000 0.00000, 1.00000 1.00000, 0.... 1 LINESTRING (0.00000 0.00000, 1.00000 1.00000, ... 2 POINT (0.00000 0.00000) dtype: geometry
>>> s.centroid 0 POINT (0.33333 0.66667) 1 POINT (0.70711 0.50000) 2 POINT (0.00000 0.00000) dtype: geometry