from_polygon_to_bounds

from_polygon_to_bounds#

from_polygon_to_bounds(polygon: ~shapely.geometry.polygon.Polygon | ~shapely.geometry.multipolygon.MultiPolygon) -> (<class 'float'>, <class 'float'>, <class 'float'>, <class 'float'>)[source]#

Convert a shapely.polygon to its bounds, sorted as left, bottom, right, top.

Parameters:

polygon (MultiPolygon) – polygon to convert

Returns:

left, bottom, right, top

Return type:

(float, float, float, float)

Example

>>> poly = Polygon(((0., 0.), (0., 1.), (1., 1.), (1., 0.), (0., 0.)))
>>> from_polygon_to_bounds(poly)
(0.0, 0.0, 1.0, 1.0)