I have a line layer showing sectors of roads that I want to style by two different fields without duplicating the layer.
"Field 1"
is an integer ranging from 0-25 defining road usage (street, path, bikelane, etc.)"Field 2"
is an integer ranging from 0-16 defining road signs that are valid within the sector
I want the line to be colored by "field 1"
(I need to be able to manually define colors for each number) and I need a centroid with different SVG-graphics depending on "field 2"
.
Is there a way to achieve that without manually adding rule-based options for all 25x16 possible outcomes?
I can now run the line color from "field 1"
via Data driven override. I am still not able to do the same with SVG graphics.
I added a marker line with a single centroid SVG-marker. I cannot manage to insert the expressions to set different files for my conditions.
I've tried full 'paths\filename.svg'
with both /
and \
or only start in from @project_folder
. This is the only way I don't get any parsing errors. I also tried using file_path()
and file_name()
which generate errors.
data driven override
on both. This should be easier to handle and change.CASE WHEN
conditions as override. E.g.case when "x" = 1 then 'red' when "x"=2 then 'blue' when "x"=3 then color_rgb(255,181,57) else 'black' end
. Same goes for symbols.right()
around your expression to extract, say, the last 30 characters and make sure you have a valid path. I regularly forget whether I should add a \ before the custom part of the path or not...