I'm trying to obtain the same label style than Perpendicular Placement Orientation from ArcGIS in QGIS. As QGIS doesn't have this feature as default, the option would be using custom placement for this.
An ArcGIS example:
A workaround in QGIS
Settings:
Data defined coordinate X (label in the middle of he line):
$x_at( num_points( $geometry)/2)
Data defined coordinate Y (same as X's location):
$y_at( num_points( $geometry)/2)
Data defined Rotation:
angle_at_vertex( $geometry , num_points( $geometry)/2)
For only for 2/3 labels, the placement is acceptable. For lines with a lot of breaks with different angles, it's more difficult to obtain a nice label.
ArcGIS seems to search the line segment with fewer breaks or a straight segment. Is there a way to obtain coordinates or geometry of the straightest line segment using Expression builder for a better label placement?
line_interpolate_angle($geometry, some lenght)
and taking severalangle_at_vertex( $geometry , num_points( $geometry))
. A loop over this function could be an aproach, but I can't do it directly in Expresion builder