13

I am trying to align road names in a row, or column as much as possible in QGIS. I know it can be done in Adobe Illustrator with a mapping plugin, but I don't have the $$ for that.

I tried something like this but it didn't didn't seem to help.

This is an example: enter image description here

It doesn't need to be exactly like that, but I'd like to do something similar.

23

(1) Draw a line as the guide for the label position.

In this example this guideline layer has an id field "fid" with only one value (1).

(2) Go to the Layer properties | Labels | Placement.

There you will find Data defined | Coordinate X and Y. Select Edit from each pull-down menu.

enter image description here

(3) Give an expression:

x: x(intersection($geometry, geometry(get_feature('guideline', 'fid', '1'))))

y: y(intersection($geometry, geometry(get_feature('guideline', 'fid', '1'))))

enter image description here

(4) As the final step, please hide the guideline. Select the guideline layer and change the symbology to No Symbols.

enter image description here

  • I'm always amazed at what we can do with the different functions/expressions. Another use case to remember! – Gabriel C. Jan 23 at 16:52
  • @GabrielC. I cannot agree with you more. I'm so grateful to QGIS Dev team for these amazing expressions! – Kazuhito Jan 23 at 17:20
  • Wow! Thanks a lot! 1 more question and I'll definitely mark that as my answer. How do I then add a second line for if my roads go into another county, and need different names, or to do the roads that run the other way? – Troy Buerge Jan 23 at 23:03
  • I know it could be done by making a duplicate of the road layer, showing only labels, and not symbology, and marking the labels for "('guideline', 'fid', '2'). but I'm sure there is a better way. – Troy Buerge Jan 23 at 23:21
  • Thanks @TroyBuerge But I am sorry I cannot think of any better solution than you have in your comment. – Kazuhito Jan 24 at 4:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.