- Run QGIS. Display some layers, e.g. stations.
- In the Layer Panel, mouse right click on the layer to be labelled, e.g. stations.
A pop up menu appears. - Choose Properties.
The Layer Properties dialog box appears. - Choose Labels. In the combo box, select Show labels for this layer.
- In the Label with field, click the Expression icon.
The Expression dialog box appears. - In the Expression tab, type in the syntax to form the multi-column label e.g.
name || ' ' || code.
Note: name and code are two columns from the layer database table, and || is the string concatenation operator and ' ' is a space character. - Click OK. And Click OK to apply the changes.
The labels appear. - If multi-line labels are desired, then the newline character '\n' needs to be concatenated with the database fields in the Expression dialog box, as shown below.
name || '\n' || code
And the resultant map look like this.
Monday, May 1, 2017
Create labels from multi-columns in QGIS
It is quite simple to create labels from one or more database columns in QGIS; just that you have to type in the correct syntax as shown below.
Labels:
Cartography,
QGIS
Subscribe to:
Post Comments (Atom)
3 comments:
Is there a way to make this appear as a table e.g.
Name xxxx
Age 19
Gander M
@Map Learner, sorry I don't think it supports HTML table tags
you can try this:
concat( 'Name:',name) || '\n' || concat( 'Age:', age)||'\n'||concat('Gender:',gender)
Post a Comment