2

I can find similar questions but not the same and I'm struggling to figure it out.

I have species data for an area. The attributes I'm interested in displaying are the Species Group and the Species Name.

I would like the Species Group to be displayed as different shapes and the species names displayed as different categorized random colours.

I have tried categorizing the species groups and manually setting the shape, changing to rule based styling, 'Refine Selected Rules' then 'Add categories to rule' for a single species group to classify the Species Names but I end up with all species categorized including species not in that group.

Any help/ideas welcome.


I followed this by going to layer properties > Symbology > Categorized > Value = species_name > symbol >Marker > Simple Marker

Then i edited the shape I followed this by going to layer properties > Symbology > Categorized > Value = species_name > symbol >Marker > Simple Marker

Then i edited the shape see below image of shape expression

But when i go back to symbology and classify the species names, they are all the same shape still.

3
  • 1
    Have you looked at the actual result on the map ? it's only there that each case related marker will appear thanks to the override. The symbol editor/legend does not know about the conditional formatting
    – Kasper
    Jan 11 at 13:19
  • Ahh very clever. It does show on the map. However, the legend still shows them all as simple markers. How do I make the legend catch up with the override? Jan 11 at 15:03
  • Legend does not know the override either, or at least I don't know if there is a workaround, might be a topic for another dedicated question. Maybe in Layouts with 'data defined legend labels' bit that's just an assumption
    – Kasper
    Jan 11 at 15:09

1 Answer 1

2

A solution is to data drive the shape with your group field data. In the style properties of your layer, go to the shape selection area for your point layer and click on the dropdown icon at the left :

shape data driven

then edit the expression and paste an expression like that :

CASE
  WHEN "group" = 'group1' THEN 'square'
  WHEN "group" = 'group2' THEN 'diamond'
  ELSE 'triangle'
END

Here the field name is "group", so replace with the exact name of your field, and create as many rules WHEN ... THEN as differents groups. You can have the shape category by hovering the shape and wait for a tool hint (like the octagon in the screenshot above).

Then you can style your layer by category, random colors, on the "species_name" field.

2
  • 1
    Was about to post the same answer. Legend won't explicitely show which symbol belongs to which group (unless there's a tip to handle that). This might be solved by a similar approach with relevant SVG symbols
    – Kasper
    Jan 11 at 11:18
  • 2
    an other solution, which takes more time, is to categorize the layer on the expression "group" || ' ' || "species_name" and affect a symbol manually ... Jan 11 at 11:28

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.

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