How to create vertical labels (each label in new line) like:
1998
150
pipe name
and not horizontal:
1998 150 pipe name
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityYou can use a QGIS expression in the label expression.
"Date" || '\n' || "Size" || '\n' || "name"
You can even wrap the expression over multi lines to do the same thing
"Date" || '
' || "Size" || '
' || "name"
Note the '
at the end and start of each line. The first is clearer with its intentions so I would use that.
If one of the fields can contain NULL
values, you can use concat()
instead of ||
concatenator:
concat("Date",'\n',"Size",'\n',"name")
An alternative to Nathan's excellent reply is to use the new labeling tab in QGIS 1.9 (also available in 1.8 but not from the layer properties menu. Instead go to Layer->Labels).
If you scroll down on the label settings tab you will find a Multiple Lines option, where you can specify the character to wrap the line on. This will be helpful if you are concatenating your string using something other than a newline character (as per Nathan's reply) or you have a string that is held in a single field (I often have to contend with slightly 'messy' data from other sources like this).
The other advantage of the multiple lines option is that you can specify alignment and line height too. So you could concatenate using spaces and then align centrally or to the right with a 1.5 line spacing (if that is cartigraphically appealing).
e.g. "Date" || ' ' || "Size" || ' ' || "name"
...with wrapping set to a single space plus align set to 'right' might give you something like:
1998
150
pipe name