A picture is worth a thousand words:

stacked bandwith (source: a traffic modelling suite) This is what I want to create in Qgis: a plot where the thickness of a line depends on the sum of three attributes (let's call them A, B and C) where the bandwidth of each attribute depends on its value and has its own colour.

I know how to make the line thickness variable depending on the value of an attribute, but is it possible in Qgis to combine different attributes like above?

  • Welcome to GIS SE. What other attributes is it that you wish to join? – Knightshound Sep 28 '16 at 9:43
  • Are the attributes A, B, and C going to change or are they static? – Ed Rollason Sep 28 '16 at 9:45
  • Why dont you create a new attribute that contains the sum of the three attributes? And base your color on the newly created attribute? – julsbreakdown Sep 28 '16 at 9:56
  • Thanks for you quick responses! The attributes are traffic flows, so they vary per link. Let me give an example: A=100 (green), B=500 (blue), C=400 (orange). The total bandwidh should be 1.000, of which 100=green, 500=blue and 400=orange – Niels Sep 28 '16 at 10:37

I also work with transport modelling and I know what you want to achieve.

This is not an easy ask in QGIS but it is possible. I've done it successfully using Single symbol>Line then adding a new attribute line for each class:

enter image description here

Then you'll need to tell each class line how wide to be and also what colour to be based on if statements (NB: the colours in the picture above are overridden by if statements). See next image for example. Luckily these if statments are pretty similar, so once you have built them up for colours, you can use them with a little adjustment to also call your volumes for bandwidth thickness.

enter image description here

Finally, you'll need to add your volume if statements for the offsets, so that the thickest bandwidth is offset by the thinnest, and the next thinnest. So you'll have three if statements added together in the thickest volume field.

Someone should really write some code to do this easily in QGIS!


Chose an expression for your line width: Line width -  expression

Then you can use any expression you like, including "A"+"B"+"C".

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.