TransWikia.com

How do you create a two tier label

Geographic Information Systems Asked by TonySomerset on July 12, 2021

QGIS Zurich 3.18.2 -Win10

I have a virtual layer that has multiple polygons each with two pertinent Attribute fields. "Field1Name" and "Field2Name". I can set and Style the Label for one field and I can display these two fields as a Label, using the Expression Value "field1name" || 'n' || "field2name".

BUT is it possible to set a different Text/Render Style for each of the two fieldnames in the Label to display at the same time? I want both fields data to appear within the polygon label, but one highlighted, bold and large and the other subordinated, smaller less obvious. If I set up two Text Styles up is there an Expression that will achieve this two component styled Label?

One Answer

Yes this is possible. To do this you need to set labelling to rule based labelling. One rule will be for your top line and the second rule for the bottom line. You don't to set any filters for the rules but you can set them to display different fields and have different label symbologies. There may just be a little bit more effort involved in getting the spacing correct between the different lines as you will probably have to do this using offsets instead of a line break.

EDIT: To edit the vertical spacing for each rule: open the rule's properties, go to Placement, set the mode to 'Offset from Point', and adjust the offsets under Offset,X,Y. Y adjustment highlighted here: enter image description here

Answered by TeddyTedTed on July 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP