[Qgis-user] Vertical Line Labeling Orientation

Hugh Kelley hghklly at gmail.com
Wed Oct 2 04:44:00 PDT 2024


Hi,
I'm looking for suggestions or guidance for handling some fine tuning of
line labels where semi-vertical lines are creating some challenges.

The map layout i'm using is rotated so that a main street line is always
oriented horizontally with labelled cross streets running vertically.

The issue is that when a cross street is oriented slightly towards the
upper right, the label is rendered with the bottom towards the right, so as
not to be "upside down". The same is true of streets slightly angled toward
the upper left.

This creates labels that, to the human eye, should be oriented the same
because they look vertical, 90 degrees, but are rendered "incorrectly"
opposite to each other, because mathematically they are a few degrees off
from 90 and one would need to technically be upside down.

So far I've spent some time with expressions using azimuth, main_angle and
case statements but haven't had a lot of luck changing the orientation of
the line labels.

The one thing that has worked is setting the label to match the orientation
of the (single) linestrings, ST_Reverse in postgis can then reverse the
label orientation, but this creates 2 problems. The first is that my
conversion from an st_union'ed multilistring to an st_linemerge'd single
linestring results in some broken lines and other messy geometries. The
second is that there are a few cases where the orientation of the map
requires labels to be flipped depending on which page of the atlas is being
rendered, so a dynamic label orientation setting would be much preferable
to a static one based on the orientation of the underlying geometry.

Thanks for any and all suggestions, feeling like I have run out of things
to try. It may be time to pass this off to the illustrator folks for manual
clean up but I do try to fix these things programmatically as much as
possible.

best,

Hugh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20241002/4b1f3a87/attachment.htm>


More information about the QGIS-User mailing list