I have following problem: I have diffrent locations where I found amphibians. Now I want to create a map where the form/shape of the point illustrates the specific species (waterfrog, common toad, etc.) and the fill color the stadium (adult, juvenile, etc.). I find a way doing that by using the expression string filter.

I created following codes for the geometry:

   WHEN "Art" IS  'TM'  THEN 'circle'
   WHEN "Art" IS  'WF'  THEN 'square'
   ELSE 'triangle'

and for the color

WHEN "Stadium" =  'ad'  THEN  '#fce8d5' 
WHEN "Stadium" =  'juv'  THEN  '#ffd3el'
WHEN "Stadium" =  'Larve'  THEN  '#85b66f'
ELSE  '#0a97b0'

The problem now is that I want to create a legend where the diffrent forms/shapes and colors are listed as well (so far only the layer itself is listed).

So I either need a tip how to fix my legend or I need a diffrent approach to get my forms and colors.

  • 1
    Why not use categorized symbology for species ? QGIS can already create the right legend for that. You can even mix the two fields for complete categories but too long for manual assignment and too long legend I think. I advise you to duplicate your layer, to do a categorized legend with the Stadium field and mask this layer, so, you can have the two legends. Sep 10, 2020 at 12:37
  • Hmm. I tried to use the categoization for the species and that works fine, but I dont know how to integrate the stadium into that. So either I have diffrent color or I have diffrent forms, but I need both. Sep 10, 2020 at 13:30
  • 1
    If you do a legend with the 2 parameters, the legend length will be length of distinct species x length of distinct stadium, maybe it's not a good idea if the legend length is too long. If you want it anyway, make a categorized symbology with the expression "Art" || '_' || "Stadium". If you want a shorter legend, consider my first comment with two separate legends, one layer with a categorized legend for species with color managed by your CASE WHEN, and the same duplicate layer with a Stadium symbology to access easily to the legend generated by QGIS. Sep 10, 2020 at 13:54


Your Answer

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

Browse other questions tagged or ask your own question.