How can I calculate dominant angle of a polygon in QGIS without main_angle function?
I have a shapefile of Oriented Minimum Bounding Box rectangles (accessible from the following link: https://drive.google.com/drive/folders/1Xr_0Apg9s7s0daevIUctWTr0-WCABC83?usp=sharing) produced by using as Input Layer a shapefile of irregular polygons (accessible from the following link: https://drive.google.com/drive/folders/1BKp5VbR1aMAzCObGprvqeL0WSMqpTX32?usp=sharing)
Figure 1: Shapefile of Oriented Minimum Bounding Box
I need to find the main_angle of every polygon in the Oriented Minimum Bounding Box layer.
I used the main_angle function available in QGIS 3.16 onwards.
main_angle function returns the main angle of a geometry.
However, when I constructed centerlines using the centroid of the polygons (in this case rectangles) and main_angle values computed using the main_angle function in QGIS with the following expression:
Main_angle of the polygons computed with main_angle function is not at all times
the angle of longest collection of segments as in the image below encircled below:
What expression can be used such that main_angle is always the angle of longest segment of the Oriented Minimum Bounding Box in a project whereby main angle of every Oriented Minimum Bounding Box is the determining factor of accuracy of end results.
I found this comment from the following link: https://georezo.net/forum/viewtopic.php?id=119435
You need an expression dependent on the height and width data:
The end result I am seeking is the overall orientation of all ploygons collectively as illustrated in the image below from the Line Direction Tool QGIS plugin. By unfortunately provides no values.
I used XLSTAT to use Principal Component Analysis but did not achieve conculsive results. Computed results and report is accessible from following link: https://drive.google.com/drive/folders/1CHDfJ9poD8tk-KQLmRV8NbilZCyGtTs5?usp=sharing