1

I created a complex style for a layer using rule based styling. In the original project, the layer is presented in the layers panel the same way it is displayed in the layer properties, that means grouped into several main categories with sublevels, as shown here:

enter image description here

The advantage is, that I can turn of entire layers of information, if needed. However upon loading the style from a QML into a different project, all symbols are now on on level and can only be disabled one by one, as shown below:

enter image description here

In the QML-file the structure looks fine to me:

<rules key="{63dbbb5f-7045-4662-840c-38d549e97198}">
  <rule symbol="0" key="{e678f11f-2cbe-4513-99fe-31c8ecdc4580}"/>
  <rule label="Urgency Classification" key="{97cbfa40-fc6d-4947-b8e0-e0249feef0ef}">
    <rule label="UC NULL" symbol="1" filter=" &quot;Priorisierung&quot; IS NULL OR &quot;Priorisierung&quot; = -1" key="{4aa49c55-6372-493c-a878-bfa6d9556c66}"/>
    <rule label="UC-" symbol="2" filter=" &quot;Priorisierung&quot; = 0" key="{dae3145c-3045-4eb3-91bf-49c024514dbc}"/>
    <rule label="UC1" symbol="3" filter=" &quot;Priorisierung&quot; = 1" key="{46e4ced4-89c7-4fce-a1b2-797a89ce52fa}"/>
    <rule label="UC2" symbol="4" filter=" &quot;Priorisierung&quot; = 2" key="{52485093-9bf9-401c-8a7a-4c1cce6448fe}"/>
    <rule label="UC3" symbol="5" filter=" &quot;Priorisierung&quot; = 3" key="{3d9ca004-ea0a-477a-8d7f-49e098253ee8}"/>
  </rule>
  <rule label="Condition Classification" key="{f3c22636-1bd6-4d66-ae95-00d80bea51bc}">
    <rule label="CC NULL" filter=" &quot;Zustand&quot; IS NULL" key="{71db925f-5db2-465e-b7f8-fa9e1072dce6}"/>
    <rule label="CC0" symbol="6" filter="&quot;Zustand&quot; = 0" key="{d6942724-2992-4afd-9c7d-e002e2843a6e}"/>
    <rule label="CC1" symbol="7" filter="&quot;Zustand&quot; = 1" key="{4b19a241-8bbb-48b2-9d2b-0da99304b858}"/>
    <rule label="CC2" symbol="8" filter="&quot;Zustand&quot; = 2" key="{5c267bc0-1137-4c0c-96fd-ab50d744e39b}"/>
    <rule label="CC3" symbol="9" filter="&quot;Zustand&quot; = 3" key="{ec10e658-949e-44da-909a-a9444628932a}"/>
    <rule label="CC4" symbol="10" filter="&quot;Zustand&quot; = 4" key="{26d7fb9c-464d-4e81-9312-65b6be0105c0}"/>
  </rule>

This appears to be just a bug, but I don't find any way, to turn back to the grouped view, without redesigning the entire style.

Edit: I am using QGIS Version 3.16.3.

5
  • What happens when you save the style with the same name and path as the data and then load the data into the other project?
    – Erik
    Commented Jan 25, 2022 at 11:11
  • The same effect. That did not work. Commented Jan 25, 2022 at 13:18
  • Are those different data sets? Which QGIS version did you create the styles with?
    – Erik
    Commented Jan 25, 2022 at 13:32
  • See edit: 3.16.3 Commented Jan 25, 2022 at 14:12
  • have you tried to open the styled and unstyled layers in two different instances of QGIS and just right click the already styled layer - > Style -> Copy Styles -> All Styles and paste this into the new project/layer (right click the unstyled layer -> Style -> Paste Styles)?
    – sn1ks
    Commented Jan 25, 2022 at 14:36

1 Answer 1

1

I have checked QML file structure in QGIS 3.16. And your QML file is not corrects.

This line

<rule label="Urgency Classification" key="{97cbfa40-fc6d-4947-b8e0-e0249feef0ef}">

not have filter and symbol number. Filter and symbol number are in the next line

<rule label="UC NULL" symbol="1" filter=" &quot;Priorisierung&quot; IS NULL OR &quot;Priorisierung&quot; = -1" key="{4aa49c55-6372-493c-a878-bfa6d9556c66}"/>

You have to try to riarange QML FILE, puting filter and label in the main rule tag so (check only that filter is corrects):

 <rules key="{63dbbb5f-7045-4662-840c-38d549e97198}">
  <rule symbol="0" key="{e678f11f-2cbe-4513-99fe-31c8ecdc4580}"/>
  <rule label="Urgency Classification" key="{97cbfa40-fc6d-4947-b8e0-e0249feef0ef}" symbol="1" filter=" &quot;Priorisierung&quot; IS NULL OR &quot;Priorisierung&quot; = -1" />
    <rule label="UC-" symbol="2" filter=" &quot;Priorisierung&quot; = 0" key="{dae3145c-3045-4eb3-91bf-49c024514dbc}"/>
    <rule label="UC1" symbol="3" filter=" &quot;Priorisierung&quot; = 1" key="{46e4ced4-89c7-4fce-a1b2-797a89ce52fa}"/>
    <rule label="UC2" symbol="4" filter=" &quot;Priorisierung&quot; = 2" key="{52485093-9bf9-401c-8a7a-4c1cce6448fe}"/>
    <rule label="UC3" symbol="5" filter=" &quot;Priorisierung&quot; = 3" key="{3d9ca004-ea0a-477a-8d7f-49e098253ee8}"/>
  </rule>

From which QGIS version derives your QML file?

If you don't want rewrite QML File you can riorganize your stile in QGIS, Putting sub-class under your main class

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.