geopandas.GeoSeries.minimum_rotated_rectangle#
- GeoSeries.minimum_rotated_rectangle()[source]#
Returns a
GeoSeries
of the general minimum bounding rectangle that contains the object.Unlike envelope this rectangle is not constrained to be parallel to the coordinate axes. If the convex hull of the object is a degenerate (line or point) this degenerate is returned.
See also
GeoSeries.envelope
bounding rectangle
Examples
>>> 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