Quick Solution:
In layer properties dialog for this layer you can set the general label rotation (layer properties > labels > placement).
If the number for the map rotation in print composer is 30 (it rotates clockwise), then the number for the label rotation is 30 (it rotates counter clockwise).
Does it work with your layout?
I have to say that what you are requesting is complicated a little bit because you want the labeling to be visible at small scale clearly as well as at large scale (best fit). So, the idea here is how to place the point that can be visible at different scales.
After several testing, I found that instead of creating several columns for each scale range and put coordinates for x and y at fixed points, you can create only one column for priority positions for each point for best location, as you can see below (I followed the locations in your file):
Then, you go to Layer propoerties -> Labels -> Placement -> Offset from point
or Around point
, both are OK, but I chose Offset from point
.
At Quadrant
Select Data defined override -> Edit
, and enter the
following formula:
CASE
WHEN $scale >= 200000 THEN "priority"
WHEN $scale < 200000 and $scale >= 75000 THEN "priority"
WHEN $scale < 75000 and $scale >=10000 THEN 5
WHEN $scale < 10000 THEN 2
END
Here, "Priority"
is the location of points defined in the field name Priority
You need to use offset to shift the points for better visibility, and I used the following formula:
CASE
WHEN $scale >= 200000 THEN '0.001,0'
WHEN $scale < 200000 and $scale >= 75000 THEN '0.001,0'
WHEN $scale < 75000 and $scale >=10000 THEN '0.0005,0'
WHEN $scale < 10000 THEN '0.0001,0'
END
Here is the output at different scales:
In order to see what each number [0-8] represents in which location, please have a look at following image:
You can control the position of the labels by adding the value corresponding with each position. But unfortunately, you cannot do it by 'click-and-move' approach. You need to do it in the attribute table.
Update:
Based on your requirement that 9 quadrant positions are not enough, I found if you select Cartography
instead of Offset from point
, and select priority, as in the image below, you will have 12 priority positions instead of 9. You need to create a field of Text
type, then put only the abbreviation that you want for the best position 'TL', 'TSL', 'T'...etc. Also, you can enter a distance to avoid the label from covering the point.
Best Answer
Use
concat()
function. It ignoresNULL
values and returns an empty string''
instead ofNULL
and therefore gives you a result if one or more fields areNULL
. This is not the case for||
concatenator.||
returnsNULL
as result if at least one field/value isNULL
.Use concat the following:
To skip concatenations of empty fields, e.g.
concat("field_a",' is empty')
you can use a simpleif()
statement:concat("field_a", if("field_a" is null,'',' is empty'))
orcoalesce()
together with||
:concat(coalesce("field_a"||' is empty'),'',"field_b", ' is never empty')