Currently, we have a big dataset imported in our QGIS profile. Normally we would have imported this by WMS but because this particular WMS/WFS consists of more than 20 parts and the data is technically complete and will never change. We could luckily download the vector data directly. It is called the "Tertiair geologische kaart".

Which can be found here: http://www.geopunt.be/catalogus/datasetfolder/06d1a1d7-d46c-43d6-96aa-25225b57dd8b.

But here comes our problem, for this dataset no SLD or similar kind of file was constructed to make up the colour of the legend. We know how the legend is constructed on a specific field, **so that is not the problem is of the colour, which has been set as a standard for this dataset. Normally you get this with the WMS/WFS but that is not the option here. The legend is also supposed to be "Listhographic".

How do we set the symbology colour based on the colour percentage/RGB table?

There is a table that does have the colour percentages and RGB-codes, we managed to link this table based on the "code column". So, in theory, we should be able to just set symbology based on those columns and values, while still maintaining the legend as it is but the problem is we do not how to do that.

Here is a sample of the table:

enter image description here

Here is a sample of the legend: enter image description here

1 Answer 1


Since you already have the corresponding columns r, g and b, you can use data defined override. To the right of the colour field of your layer click on the rectangle with the attached small triangles, choose edit and enter the following:


then confirm.

See screenshot for example.

enter image description here

Possible issues:

  1. The columns r, g and b contain string values and not integers - in this case you can expand the expression above to color_rgb(to_int("r"),to_int("g"),to_int("b"))
  2. You need a legend and/or classification displaying the correct colours. This would mean a lot of manual work to set the correct symbol colour after running the classification.
  • The Columns r,g and b are indeed string value's. So I can use that formula of yours. But I do not understand that date defined override part. I have found it so far but the colours do not seem to change. Commented Aug 10, 2020 at 14:27
  • @ThunderSpark: I added a screenshot.
    – Erik
    Commented Aug 10, 2020 at 16:08
  • Thank you. This solved my issue. Commented Aug 12, 2020 at 6:32

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.