I have created a Polygon using the sympy.geometry
package as below:
poly1 = Polygon((39.,4.), (32.,30.), (40.,10.), (42.,10.), (43.,14.))
The points of the Polygon are lon/lat co-ordinates. I now want to project the polygon onto an ellipsoid (the Earth) and calculate the area of the polygon.
I have written the following code:
from pyproj import Proj
#specify projection for the Earth using reference ellipsoid"
wgs84=pyproj.Proj("+init=EPSG:4326")
poly1_transformed=[]
for point in poly1:
new_point = wgs84(point)
poly1_transformed.append(new_point)
However I cannot iterate over the points in the Polygon. Is there any way to do so or an alternative method such that I can project the whole polygon (and eventually calculate the area) ?
This is my error:
TypeError
Traceback (most recent call last)
<ipython-input-65-0c7501bb5894> in <module>()
5 wgs84=pyproj.Proj("+init=EPSG:4326")
6
----> 7 for point in poly1:
8 new_point = wgs84(point)
9 print (point, new_point)
TypeError: 'Polygon' object is not iterable