How do I get multiline labels if the text is too large to fit in the length of one line (street).

I know "wrap on character", but I need an automatic way to do it.


enter image description here

More details After trying the @CarlosLópezQuintanilla sugestion and fail: wraponcharacter

Analysing the problem again.

Maybe using a variable?

Perhaps here in Rule Properties > "Filter", using some kind of filter?

or in another place...

Lets think, the fluxogram should be something like:

  1. Measure the lenght of line.

  2. Measure the lenght of the text string (not by charaters, but by mm)

  3. Compares the lenght of the text string with lenght of the line (road).

  4. If the lenght of "line" is equal or less than the lenght of "text" label it with "normal" BUT If the lenght of "line" is greater than the lenght of "text" label it with "multiple lines".

Is conditional or variable. But how?

2 Answers 2


You could to use an expression for labeling.

You not must to label the "Street" Field directly:

exemple: wordwrap("Street", 14)

  • Please see my edited question. Apr 27, 2016 at 11:23
  • Perhaps you could to adjust the size of your labels. But using an "Expression". In this expression you could to use a CASE conditional, like this: CASE WHEN "type_strett"='Motorway' THEN 10 WHEN "type_strett"='Primary' THEN 8 WHEN "type_strett"='Residential zoom 1' THEN 7 WHEN "type_strett"='Residential zoom 2' THEN 6 ELSE 7 END Or you could to create a Field (integer) with the value or the size and then you could to use this field directly... Apr 27, 2016 at 15:51

Not sure if this will help in your situation but you can try using the following expression for the Wrap on character option which checks the length of characters:

Wrap on character option

CASE WHEN length("Street") > 15 THEN ' ' END

This checks that if the total number of characters for a feature in the field "Street" is over 15, the wrap character becomes a space. So:

Baker Street will be shown as

Baker Street


221B Baker Street

will be shown as:

221B Baker Street

  • But you are talking about the size of the text string, right? What I want is that there are labels that do not appear because they are too long to fit on the streets. In this case I want to appear in a second line. Please see the screenshot that I added to my question. Now we can see the text because I made another layer to that street. How to do this in the same layer for all strings that are too long to fit to the street? Apr 26, 2016 at 16:40
  • 1
    Yes, you are correct in that I was talking about the size of text string. Perhaps the answer provided by @CarlosLópezQuintanilla may help =)
    – Joseph
    Apr 27, 2016 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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