Ever wondered how to create multi-line labels in QGIS? The new labeling engine has a “Multiline labels” option but it’s not so obvious how to create a usable labeling attribute. Here is how it works (credits to @nhopton on QGIS forum):
- Create a big enough text field (if the data doesn’t contain any yet).
- In Layer Properties – Fields, chose a “Text edit” edit widget for the label field.
- Enter the multi-line text into the label field. You can do this using Attribute Table or Feature Form.
- Activate labeling. You’ll have to tick “Multiline labels” option in Layer Labeling Settings – Advanced – Options. That’s it:
A common use case is the wish to show multiple attribute values in a feature’s label. Using Field Calculator, you can combine them into multi-line labels. All you need is to combine the fields with the || operator and add ‘\n’ (newline) wherever there should be a line break:
Field1 || '\n' || Field2
And finally, the result: