shapely.bounds

Contents

shapely.bounds#

bounds(geometry, **kwargs)#

Computes the bounds (extent) of a geometry.

For each geometry these 4 numbers are returned: min x, min y, max x, max y.

Parameters:
geometryGeometry or array_like
**kwargs

See NumPy ufunc docs for other keyword arguments.

Examples

>>> from shapely import LineString, Point, Polygon
>>> bounds(Point(2, 3)).tolist()
[2.0, 3.0, 2.0, 3.0]
>>> bounds(LineString([(0, 0), (0, 2), (3, 2)])).tolist()
[0.0, 0.0, 3.0, 2.0]
>>> bounds(Polygon()).tolist()
[nan, nan, nan, nan]
>>> bounds(None).tolist()
[nan, nan, nan, nan]