TransWikia.com

QGIS label text break in data attribute table

Geographic Information Systems Asked on May 2, 2021

I would like to have my visible label text broken, which is too long.
enter image description here

I found some solution here:

How to split text attribute by characters in QGIS?

but applying the expression to my example:

  left( "Text", strpos( "Text" ,'-'))

I am getting only B3-, whereas another part of the text is gone.
I need the visible label like this:

B3-24F
DP &PSP2

instead of

B3-24F DP&PSP2

How can I do it?

2 Answers

Your expression does exactly what it is supposed to be doing. I guess you mixed up the terms "split" and "wrap".

Go to your label properties and navigate to "formatting". Then fill "wrap on character" with -:

enter image description here

Also check out the other options available there ;)

Correct answer by MrXsquared on May 2, 2021

The labels displayed in your map, and the labels displayed in the text of your question are different. The labels in the map shows B3- 24F DP & PSP2, and the labels in the text of your question shows B3-24F DP&PSP2. The former text contains more spaces compared with the latter text.

Anyway whatever the case, you need to use Wrap lines to and specify the number of characters you want, and then choose Minimum line length in the drop-down menu.

In this example, I used 6 characters. Here is the settings, and the final output:

enter image description here

Answered by ahmadhanb on May 2, 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