# Getting polygon breadth in Shapely

Is it possible to get polygon breadth in Shapely, similar to how it provides polygon length? http://toblerity.org/shapely/shapely.geometry.html

I am also ok with a solution that uses fiona or any non-arcgis open source python solution.

• One quick-n-dirty estimate of "breadth" would be to divide the polygon area by its length. This returns some kind of measurement of the average width (per unit length).
– Jon
Sep 13, 2018 at 21:48

``````# create example polygon
poly = Polygon([(0, 0), (4, 0), (5, 2), (7, 5), (3, 2), (1, 3)])

# get minimum bounding box around polygon
box = poly.minimum_rotated_rectangle

# get coordinates of polygon vertices
x, y = box.exterior.coords.xy

# get length of bounding box edges
edge_length = (Point(x, y).distance(Point(x, y)), Point(x, y).distance(Point(x, y)))

# get length of polygon as the longest edge of the bounding box
length = max(edge_length)

# get width of polygon as the shortest edge of the bounding box
width = min(edge_length)
`````` The typical length of a Polygon is the perimeter of the outer ring. If you require something else, I see in Shapely 1.6 there is a new method, minimum_rotated_rectangle. This produces the smallest rotated rectangle that encloses the Polygon. By calculating the distance between consecutive points, you should be able to determine the width (smallest distance) and length (largest distance) of your MBR. Shapely 1.6 pdf