geopandas.GeoSeries.minimum_rotated_rectangle#

GeoSeries.minimum_rotated_rectangle()[来源]#

返回一个 GeoSeries,该系列包含包围对象的最小边界矩形。

与包络不同,这个矩形不受限于与坐标轴平行。如果对象的凸包是一个退化(线或点),则返回这个退化。

另请参阅

GeoSeries.envelope

边界矩形

示例

>>> from shapely.geometry import Polygon, LineString, Point, MultiPoint
>>> s = geopandas.GeoSeries(
...     [
...         Polygon([(0, 0), (1, 1), (0, 1)]),
...         LineString([(0, 0), (1, 1), (1, 0)]),
...         MultiPoint([(0, 0), (1, 1)]),
...         Point(0, 0),
...     ]
... )
>>> s
0    POLYGON ((0 0, 1 1, 0 1, 0 0))
1        LINESTRING (0 0, 1 1, 1 0)
2         MULTIPOINT ((0 0), (1 1))
3                       POINT (0 0)
dtype: geometry
>>> s.minimum_rotated_rectangle()
0    POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))
1    POLYGON ((1 1, 1 0, 0 0, 0 1, 1 1))
2                  LINESTRING (0 0, 1 1)
3                            POINT (0 0)
dtype: geometry