1

I'm creating an atlas in QGIS showing bus lines, tax fare zones, and travel flow lines.

I have a layer with bus lines - one feature per bus line.

Moreover, I have a layer with travel flow lines - there are many features per bus line.

Both layers have a common attribute column describing the bus line.

What I want is to show the travel flows lines that corresponds to a certain bus line.

Hence, I created an atlas via the atlas feature, where the coverage layer is featuring the bus lines.

In the travel flow line layer properties I made a rule based symbology, in order to only showing the travel flow lines that corresponds to each bus line.

In the filter I put: "Rute" = attribute( @atlas_feature , 'Rute')

Now I want to style each travel flow line feature double. The line width in accordance to the amount of travellers per flow line (called 'rejsende_a') but also styled from a blue color ramp, the higher amount of travellers, the darker blue.

Here is my problem. I want QGIS to style the color of the lines from a expression, as you can see from the picture below.

enter image description here

I need to find the minimum and maximum values of the travel flow lines to the corresponding bus line that is the current atlas feature.

So far I've tried several expressions. The latest one is like:

ramp_color('Blues', scale_linear(Rejsende_a, minimum(CASE When "Rute" = attribute(@atlas_feature, "Rute") Then "Rejsende_a" end),maximum((CASE When "Rute" = attribute(@atlas_feature, "Rute") Then "Rejsende_a" end)), 0,1))

Be aware that: Rute = bus line and Rejsende_a = travellers

But apparently the syntax is wrong.

Can anybody help out here? Can you use 'CASE WHEN' in the expression string? Or how can you tell the expression to choose only the feature from the travel flow lines that has the "Rute" column in common?

  • Do you get an error? What happens which leads you to believe the syntax is wrong? – ndawson Jan 9 '17 at 22:13
  • In this case I e.g. want the 'Rejsende_a' values from 'Rute' = 130 and not all other values of 'Rejsende_a'. Perhaps the syntax is ok, but it does not return anything. In the expression string builder the output preview is empty and the color in the map does not scale. – kwiwe Jan 10 '17 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.