3

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.

4

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
1

For quadrant:

CASE WHEN "Strike" > 325 OR "Strike" <= 25 THEN 5 WHEN "Strike" > 25 AND "Strike" <= 70 THEN 8 WHEN "Strike" > 70 AND "Strike" <= 115 THEN 7 WHEN "Strike" > 115 AND "Strike" <= 160 THEN 6 WHEN "Strike" > 160 AND "Strike" <= 205 THEN 3 WHEN "Strike" > 205 AND "Strike" <= 250 THEN 0 WHEN "Strike" > 250 AND "Strike" <= 295 THEN 1 WHEN "Strike" > 295 AND "Strike" <= 325 THEN 2 END

For offset:

CASE WHEN "Strike" >= 0 AND "Strike" <=20 THEN '3,0' WHEN "Strike" > 20 AND "Strike" <=45 THEN '2,-1' WHEN "Strike" > 45 AND "Strike" <= 90 THEN '0,1' WHEN "Strike" > 90 AND "Strike" <= 135 THEN '-1,1' WHEN "Strike" > 135 AND "Strike" <= 180 THEN '-1.5,0' WHEN "Strike" > 180 AND "Strike" <= 225 THEN '-1.5,-0.5' WHEN "Strike" > 225 AND "Strike" <= 270 THEN '0,-1' WHEN "Strike" > 270 AND "Strike" <= 315 THEN '0,-1' WHEN "Strike" > 315 AND "Strike" <= 359 THEN '3,-0.5' END

  • Will there ever be a case when strike > 325 and <= 25 on the same time?? You should use OR instead of AND here. If you happy with my answer please accept it with the accept answer button. This would close the answer and help other in the future for a status. – Jakob Jun 18 '15 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.