QGIS Angles – Calculating Polygon Main Angle Using QGIS: Detailed Method

anglesqgis

At the moment I have split my imported shapefile into the parts with the function 'qgis: explode' (pic1 & pic2):

pic1 & pic2

Next I want to the polygon main angle of each "exploded" element.

In ArcGIS there is the function "Calculate Polygon Main Angle (Cartography)" which solves this problem, but I didn't find a suitable function for it in QGIS. "Calculate Polygon Main Angle (Cartography)" creates a new column in the. dbf file and fills it with the angles of each element.

Is there an equivalent function in QGIS?

Best Answer

QGIS has a main_angle(geometry) function since version 3.16: https://www.qgis.org/en/site/forusers/visualchangelog316/index.html#add-main-angle-function-to-return-the-estimated-main-angle-of-a-geometry

To calculate it you can use the expression main_angle($geometry) for a new field.

Be aware that it might return unexpected results or require further processing. See the GIF in the changelog (https://www.qgis.org/en/_images/87367553-aae7d680-c5be-11ea-923a-e81200f2b90c.gif) for an example.

Related Question