# Expression for placement of label 'offset from point' by azimuth field using QGIS?

I need help making an expression for labelling points, such that the label is placed in one of the 8 quadrants (above point excluded), based on the azimuth field of the point.

For example, if the azimuth is from 338-23 degrees, place in quadrant 1, if the azimuth is from 24-69 degrees, place in quadrant 2, and so on.

You can databind the label Placement Quadrant with this expression structure:

CASE
WHEN azimuth < 23 OR azimuth > 338 THEN
1
WHEN azimuth > 24 AND azimuth < 69 THEN
2
ELSE
3
END

You may also need an expression calculating a more appropriate offset depending on the azimuth.

Update:

The offset can databind to an expression like this:

CASE
WHEN azimuth < 23 OR azimuth > 338 THEN
'0,-1'
WHEN azimuth > 24 AND azimuth < 69 THEN
'1,0'
ELSE
'-1,0'
END

Negative x-values moves label west. Negative y-values moves label north. So '0,-1' means an x,y offset in 0 for x and 1 up north. Pick the unit used as map units, if you not using lat-long coordinates.

• Good one. Leave it to a geologist to come up with an expression for placement of dip labels! Unfortunately you are also right about the offset. The labels are too close to the point. Any idea on an accompanying expression for offset? – Chris Jun 16 '15 at 23:59
• Added an expression skeleton for offset. – Jakob Jun 17 '15 at 7:58
• Thanks for the skeletons Jakob. I'm posting the final expressions I used for quadrant and offset for placement of dip labels around strike/dip geology symbols. – Chris Jun 18 '15 at 1:58