utils.polygon_to_bounding_box#

seismostats.utils.polygon_to_bounding_box(polygon: Polygon) tuple[float, float, float, float]#

Get the bounding box of a Polygon.

Parameters:

polygon – Shapely Polygon.

Returns:

tuple – The extend of the polygon with minimum and maximum coordinates of x and y.

Examples

>>> from shapely.geometry import Polygon
>>> polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0)])
>>> polygon_to_bounding_box(polygon)
(0.0, 0.0, 1.0, 1.0)