2

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:

enter image description here

EDIT: Example added.

2
  • Some pictures would help explain what you're trying to do. Of what is your data comprised, and what part of it do you want to color?
    – Pointdump
    Commented Jan 9, 2022 at 16:05
  • I added a picture in my original post. I'm looking for a possibility to change the colours of all coloured dots (= simple markers of differenz sizes) at once by the changing colour values in the file "entity_colour.csv".
    – Alrik
    Commented Jan 9, 2022 at 21:38

1 Answer 1

2

You can join the layer containing the color definitions to the layer containing the geometries.

To set the Join field and the Target field, in the example from your screenshot, in datafile_01_entity_b, datafile_02_entity_b, and datafile_03_entity_b, create a new field color and fill it with value b.

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.

1
  • Thanks! I solved the problem the way you proposed. However, it would have been much easier (without editing all the CSV files) if it would be possible add "globals tags" to layers. In this case, the entity's name (for example "a").
    – Alrik
    Commented Jan 12, 2022 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.