I have a list of rectangles imported from a shapefile into Python in degrees. (EPSG:4326)
rectangles = [{'type': 'Polygon',
'coordinates': [[(-61.55002968237319, 73.546895599812856),
(-61.55006750140465, 73.54690126492163),
(-61.55004657065852, 73.547002738155776),
(-61.55000884141658, 73.546996653057328),
(-61.55002968237319, 73.546895599812856)]]},
{'type': 'Polygon',
'coordinates': [[(-61.55006750140465, 73.54690126492163),
(-61.55010523064657, 73.54690693003006),
(-61.55008438977398, 73.547007961258084),
(-61.55004657065852, 73.547002738155776),
(-61.55006750140465, 73.54690126492163)]]},
{'type': 'Polygon',
'coordinates': [[(-61.55010523064657, 73.54690693003006),
(-61.55014304972003, 73.546912595138153),
(-61.55012211897393, 73.547013646160064),
(-61.55008438977398, 73.547007961258084),
(-61.55010523064657, 73.54690693003006)]]}]
What I would like to do is calculate the area of each rectangle in square meters, and then the length and width of each rectangle in meters. There is no guarantee that the coordinates are in the same order for every rectangle.
What I would like to do is output a Python list for each metric, for example
area = [10.933836, 10.920366, 10.872225]
length = [4.721, 4.703, 4.725]
width = [2.316, 2.322, 2.301]
(Those are not the actual dimensions from the coordinates above, just an example of the output format.)
I tried using GeoPandas, but when I try to convert from EPSG:4326 to any other projection, the Python session hangs and doesn't complete, even for small files with only 3 shapes. For example, I tried
import geopandas as gpd
test = gpd.read_file('test.shp')
print(test.crs)
> {'init': 'epsg:4326'}
test = test.to_crs({'proj':'cea'})
The last line never completes, even for small files, I'm not sure why.
What are some approaches I can use to calculate the area, length, width for multiple shapes and output to lists in Python?