I have found a really helpful tutorial to style points based on two attributes.

Is it possible to make style lines based on two attributes?

I have a shapefile with streets that have two attributes: traffic and lanes.

I can draw a thicker line based on the number of the lanes and color the lines from green to red with the traffic index, but I can't combine the two.


If you only got one discrete attribute (road type) and one pseudo-continuous attribute (number of lane) I think you don't even need to use the rule-based renderer which is the way to go if you got more complex situations.

  1. So in you layer properties select categorized style.
  2. Select the column that contain road type
  3. Change the symbol and add a data-defined expression for the width of the lane such as to_real(lane_count) * 0.25 0.25 being an example of desired width for each lane
  4. Hit the classify button so one color is given to each road type
  5. Adapt style to your need
  • 1
    To fine-tune the color there is also this approach: gis.stackexchange.com/a/166057/9839 – Matthias Kuhn Oct 30 '15 at 8:40
  • Thank you Matthias Kuhn this is a good alternative, thus more complex, if you have to deal with two continuous variable. – MarHoff Oct 30 '15 at 8:55
  • Thank you all! MarHoff answer works like a charm. @MatthiasKuhn suggestion will be good for a third attribute. – Lorenzo Beltrami Oct 30 '15 at 9: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.