2

I want to make a complicated symbology for my layer. Now it's categorized on column use and I want to add a term "If use=street, different symbology to lamp_type column (H=(x),L=(y) and others=(z)"

(x) (y) and (z) are symbols

I mean by that, that categorized symbology has another categorized symbology in it

I have two relevant columns one is "use" which contains [road, street, etc.] and the other is "lamp_type" which contains words like [HPS,LED,MH] etc. I need to make special symbology for every item in "use" and if the "use" is "street" I need to make special symbology for every item in "lamp_type"

How can I set up symbology this way?

2 Answers 2

2

You can either use an expression which connects both columns as base for categorised style, or you can go for rule based styling. As to the specific formula: Either you give some more and clearer details on your data structure and the intended display, or you work it out yourself based on the examples in the expression dialogue.

/edit: Okay, it really is quite easy: Go to the style-tab, choose categorised and enter the following:

if ("use"='street',"lamp_type","use")

Basically this says: If the feature is registered as a street, categorise it based on the column "lamp_type", else use the column "use".

Have fun fiddling with your symbols, and bear in mind: Best not use more than seven colours, and ideally use the same colour for all "street"-features and differentiate them by using different strokes.

2
  • Ok so I have two relevant columns one is "use" which contains [road, street, etc.] and the other is "lamp_type" which contains words like [HPS,LED,MH] etc. I need to make special symbology for every item in "use" and if the "use" is "street" I need to make special symbology for every item in "lamp_type"
    – tristramit
    Commented Aug 22, 2018 at 12:36
  • Added the "code" to my answer. If it doesn't work, please report any error messages.
    – Erik
    Commented Aug 22, 2018 at 13:14
0

Yes, your request is easily solvable using the Rule-based symbology.

In the "Use" layer symbology, select the option Rule-based: here you can create different rules, one for each typology of use, just filtering with the expression

"Use" LIKE "Street"  

You can create rules for one or more "Use" attributes. When all your "use" rules are ready, you can create a sub-category inside each of them, categorising the style according to a second attribute that in your case will be "lamp_type", filtered by the presence/absence of the field attribute "use".

To do it, right-click in the rule label and in the menu and select Refine Current Rule > Add Categories to Rule

enter image description here

This will open a new window for categorising the symbology: here select the expression symbol in the right of Column and use the expression

IF ("use" like 'street', "lamp_type", NULL)

This will create a selection of lamp_types that have that use as attribute. All the others will be ignored. Press Classify and you will have your selection. I suggests to remove now the Null option (the green in the image).

enter image description here

Repeat the operation for all the uses attributes.

Two necessary steps to have a good result are:

  1. Make not visible the Use symbol to allow the underlying symbols to be visible: to do this right-click in the Use rule Label and select Change opacity from the menú > opacity to O.

  2. The system, as you will realise, create a label for the lamp_type using the expression and his result. Double-click in the label name and change it from the default to the correct label that you want to show.

Your final result will be to possibility to have in your Layer manager a different voice for any lamp_type that is contained in use street.

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.