4

I've created some multi-line labels in QGIS 2.18.12 using the expression:

 "PIPE_DIA"  || 'mm' ||  ' ' || "PIPE_MATRL" ||  '\n'  ||  'US Depth: ' ||   ( "START_COVELEV" - "START_INVELEV")  || '\n' ||  'DS Depth: ' ||  ( "END_COVELEV" - "END_INVELEV" )

All ELEV fields are double with precision to 3 decimal places.

The output however randomly spits out an extra 11 decimal places like this: Label_QGIS

I've gone into label properties and set decimal places to 2 but it does nothing. I've also tried using the concat( function instead but it returns the same error.

Anyone have any ideas or work arounds?

1
  • I should add that it is occurring randomly on both the US Depth and the DS Depth labels but not every label.
    – Steve H
    Nov 6, 2017 at 3:08

2 Answers 2

6

As a workaround you can force the labels to round to the 3 decimals by adding the following expression before calculations:

"PIPE_DIA"  || 'mm' ||  ' ' || "PIPE_MATRL" ||  '\n'  ||  'US Depth: ' ||  round(( "START_COVELEV" - "START_INVELEV"),3)  || '\n' ||  'DS Depth: ' ||  round(( "END_COVELEV" - "END_INVELEV" ),3)   

Notice the round(( "START_COVELEV" - "START_INVELEV"),3) and round(( "END_COVELEV" - "END_INVELEV" ),3)

1
  • Glad I could help
    – ahmadhanb
    Nov 9, 2017 at 3:10
-1

This is an issue with a particular release of Qt. Try an update to a later version of Qt, or update the version of the operating system you are using. This problem stopped for me when I upgraded from Ubuntu 16.04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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