Is there a way in QGIS to figure out the direction of a polygon, if there are no values given? What I need to know is if a polygon is directed to the south.
I want to know the direction of a house because of a solar research. I want to say if the longer side of a house is directed to the street and this direction is south or north or west or east.
Best Answer
$length < (minimum( $length , "gid" )+ 0.1)
The shortest sections of each building have the same or near the same length, so two sections will be selected for each building. For some reason not all the necessary lines are selected and I had to select several lines manually. Does anyone know why? Alternatively (or maybe better) use this:
$length != maximum($length, "gid")
degrees (azimuth(point_n($geometry,1),(point_n($geometry,2))))
I see two problems in this method: 1. It is not known that line runs from north to south or from south to north. 2. For some geometries, the result may be different than expected (see largest geometry above).
Works in QGIS 2.18 and later. Does not work in older.