I am using the QGIS expression builder for the label properties of my data.
Is it possible to put different parts of the label in different coordinates on the map?
For instance I have a linestring and I would like to have "A" displayed in the beginning of the linestring and "B" in the end of it.
Answer
One method is to use Rule-based labelling and adding two rules for "A" and "B".
Go to
Layer Properties > Labels
and change the optionNo labels
toRule-based labelling
. Then add a rule by clicking the green plus icon:Set the relevant options as shown such as
Label with
(use something'A'
) and theCoordinate X Y
. For the x-coordinate, clickEdit...
and use$x_at(0)
to place the label at the start of the linestring; for the y-coordinate, use$y_at(0)
.Repeat Step 2 for "B" but for the x-y-coordinates, use
$x_at(-1)
and$y_at(-1)
respectively for the end of the linestring.When you click Apply, hopefully you should see something like this:
No comments:
Post a Comment