2

Can I set up a variable such that the line parameters are based on this variable - for example, so I can set up line width, offset, label, and label rules based on a variable, defining the variable as a particular field of data (or an expression using multiple datasets)?

For my purposes I work with traffic projections - datasets I work with typically have speed/delay/volume for AM/PM in multiple projection years (2020/2025).

A particularly useful plot I use is a bandwidth plot (similar to the size graduation style), a visual representation whereby higher road volumes are shown with wider lines - however unlike the size graduation style, a road has two directions, and as such the lines are offset from the line position so as not to overlap the opposite direction. I also work over big areas so I don't want to show low values, so I filter these out. I may also need to use one colour for an increase in traffic on a road, and a different colour for a decrease. By this stage I have set 5 or 6 style elements based on my data, and if I want to look at the delays rather than volumes I have to manually adjust each of these style elements

I'd like to make it so I can set up my style generically, say set var="2020_AM_Volume" or var="2025_PM_Volume" or var="2025_AM_Volume"-"2015_AM_Volume", and refer to 'var' throughout my style setup - is this at all achievable?

  • I worked it out - I can set expressions as variables in layer Properties, and i can then refer to them utilising eval(var) – Lachlan Piper Oct 9 '19 at 13:03
2

The easiest way is to define a field with the average daily traffic, or the AADT if you prefer, and use that as the defining attribute for the line width.

enter image description here

then

enter image description here

If you want to display only roads above a given threshold, use the rules provided in the assistant and/or by selecting "Apply transformation curve".

An less lean alternative is to define a field (say "AADT_visual") only dedicated to the rendering, automatically calculated so that it sets to zero the AADT_visual if the volume is under a given threshold.

enter image description here

Bonus

A nice additional feat is to assign the color based on an attribute. For example you can apply a color ramp based on the mean speed, so that the resulting road network shows speed by means of the line width and average speed through the colors. You might have to experiment a little though to make the graph easy to be understood ;)

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.