1

I've been looking at the other questions relating to rule based labeling but I haven't found any answer to my query. I have polygons with average literacy rate for each canton of a country and therefore have a field named "LitRate". I'd like to show cantons with a rate higher than 5. Getting inspiration from other questions I've tried: "LitRate"= > "5" but it doesn't work.

enter image description here

  • 1
    what about "LitRate"=> 5 – Ian Turton Apr 24 at 14:52
  • 1
    double-quotes mean columns, so using "5" is telling QGIS to look for a column named 5... use '5' instead. – DPSSpatial Apr 24 at 15:00
5

Okay, your approach points in the right direction, but has the wrong syntax. Please note that you can test rules and that the help in the field calculator/expression builder is worth consulting.

First error:

= > instead of >= - QGIS doesn't know how to deal with two operators right after the other.

Second error:

"5" - things in " always refer to columns, not to values. When comparing numerical values you can omit the quotation marks, otherwise if you want to compare to a value/string of characters, use '.

Which leads to the following expression, which ought to work:

"LitRate" >= 5

3

And just a suggestion: You can round your values.

enter image description here

  • 1
    Good point, as a rule "quantities created from measured quantities by multiplication and division, the calculated result should have as many significant figures as the measured number with the least number of significant figures" (quote from : en.wikipedia.org/wiki/Significant_figures) – J.R Apr 24 at 15:19

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.