Home

Published

- 1 min read

calculate area of a polygon python

img of calculate area of a polygon python

The solution for this is noted below

calculate area of a polygon python

Solution

   In [41]: from shapely.geometry import Polygon

In [48]: coords  = ((-1, 0), (-1, 1), (0, 0.5), (1, 1), (1, 0), (-1, 0))

In [49]: polygon = Polygon(coords)

In [50]: polygon.area
Out[50]: 1.5

Try other methods by searching on the site. That is if this doesn’t work