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

2 Answers 2

# 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[0], y[0]).distance(Point(x[1], y[1])), Point(x[1], y[1]).distance(Point(x[2], y[2])))

# 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)

Polygon with Minimum Bounding Box, Polygon width & Polygon height


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.