I'm using QGIS 3.22.
The problem: I have various layers with coloured symbols based based on CSV-layers. Here you find an exemplary point data CSV (but there are also CSVs with polygons), named "datafile_01_entity_b.csv":
year;x;y
"1950";23.65963;61.34182
"1990";23.67221;61.32862
"2000";23.71843;61.40720
All points resp. polygons in the layers are coloured by a colour representing a given entity (in the example above "entity b"). Each entity is represented by exactly one colour. This relation (entity->colour) is saved in another CSV looking like this (named "entity_colour.csv"):
entity;colour
a;#ff0000
b;#0070c0
c;#ffc000
To find intuitive colour palettes, I would have to change the colours of the symbol markers in all given layers.
Is it possible to "assign" a tag/entity name to a layer?
And then, using an expression in the "Symbology"/"Fill Colour" section to search for this entity name in "entity_colour.csv" and assign the given colour to the symbol layer?
In the upper example, "entity b" (or just "b") should be assigned to the symbol layer – and then, the colour for "b" in the column "entity" in "entity_colour.csv" should be assigned to all data points in the layer basing on "datafile_01_entity_b.csv".
A solution without adding the entity name in every row of the data CSVs would be great!
Is there maybe a solution with using "categorized" symbols?
Example showing several datafiles with point data:
EDIT: Example added.
Best Answer
You can join the layer containing the color definitions to the layer containing the geometries.
To set the
Join field
and theTarget field
, in the example from your screenshot, indatafile_01_entity_b
,datafile_02_entity_b
, anddatafile_03_entity_b
, create a new fieldcolor
and fill it with valueb
.So QGIS will add the color definition from your color.csv to your layer with the geometries and you can use this field for defining colors. Each time you change the color in the csv, it will change in all joined layers.