2

I have a vector layer with a field called "dBM".

through query builder, I am hoping to change change the colour of the point depending on the value of "dBM".

e.g.

 "dBM" more than 20 ----> change colour of point to green

 "dBM" less than 20 ----> change colour to yellow

 "dBM" less than 0  ----> change colour to red
3

Consider doing it with a data defined override in the styling of that layer.

This is done by opening the properties window for the layer and (1) clicking Style, (2) clicking Simple marker, (3) clicking the E xpression button beside Fill, (4) clicking Edit... and creating an expression to assign a colour based on the value in the field you want.

qgis setting a colour based on field value

The expression can be expanded from what @Jesse McMillan proposed:

CASE
  WHEN "dBM" <= 0 THEN '255,0,0'
  WHEN "dBM" > 0 AND "dBM" <= 20 THEN '255,255,0'
  ELSE '0,255,0'
END

Not sure what shades of red, yellow and green you like, but that should be a decent starting point.

  • 1
    a useful add-on to this kind of styling is using the new color variables. under document properties > default styles you can name specific colors. For instance you could have 'dBM red', 'dBM yellow', and 'dBM green'. You could then use project_color('dBM red') instead of 255,0,0 – Jesse McMillan Jan 11 '16 at 1:44
  • @SaultDon I get an error like this: Parser Error: syntax error, unexpected $end Eval Error: No root node! Parsing failed? – JolyDroneSP Jan 17 '16 at 12:04
2

This is a fairly straightforward thing to do, and there are many ways to accomplish it.

In the layer properties dialog, open the style tab. Change the style from "single symbol" to "rule-based"

Hit the plus until you have three styles. To change the rule associated with one double click it. Here are some rule examples:

Less than zero

    "dBM" <= 0

Less than 20

    "dBM" > 0 and "dBM" <= 20

21 or more

  "dBM" > 20

You could also use the categorized type style

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.