Is there a simple way / ready-to-go function to calculate the azimuth of 2D polygons in a GeoPandas DataFrame
? My goal is to eventually compute azimuth angles of building footprints.
Most of the functions I have found explicitly calculate the azimuth for a line, which is not what I am looking for. I have been thinking along the following lines to calculate the azimuth of a polygon using its normal vector (2 dimensions). Is my approach going in the right direction?
I am a bit unsure how to adjust for the quadrants, also my results seem a bit odd.
azimuth = 90 - math.degrees(math.atan2(normal[1], normal[0]))
if azimuth >= 360.0:
azimuth -= 360.0
elif azimuth < 0.0:
azimuth += 360.0