I have a layer of rubber bands. They are placed on roads before crosswalks to make cars slow down.
In QGIS + PostGIS I have them represented with polygons (orange rectangles). All the polygons have rectangular shape (2 long sides and two narrow sides). Is there any way to make the inner black lines parallel to the narrow sides?
My approach would be to develop a function that takes the narrowest side (Polyline) of the polygon and calculates the degrees of inclination with respect to the x-axis. And apply this rotation automatically to the lines of each polygon. I am not sure how to develop the function either.
Is there any simpler solution?
main_angle($geometry)+90
would return exactly what you needed for data defined override of the line filling orientation... but it doesn't. Maybe my temporary features are too crudely drawn.-main_angle($geometry)+90