geopandas.GeoSeries.代表点#
- GeoSeries.representative_point()[来源]#
返回一个
GeoSeries,该系列的点(计算成本低)保证位于每个几何图形内。另请参阅
示例
>>> 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 0, 1 1, 0 1, 0 0)) 1 LINESTRING (0 0, 1 1, 1 0) 2 POINT (0 0) dtype: geometry
>>> s.representative_point() 0 POINT (0.25 0.5) 1 POINT (1 1) 2 POINT (0 0) dtype: geometry