[QGIS-Developer] How important are rule ids (keys) in QGIS project files?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[QGIS-Developer] How important are rule ids (keys) in QGIS project files?

Andreas Neumann-4

Hi again,

During our tests and investigations around rendering problems in QGIS we found the following issue, which is really easy to reproduce:

1. Create a layer (any vector source)

2. Create a rule based symbology (e.g. by going through a classification)

3. Save qgs file

4. Export style file of first layer

5. Load the same layer as above in the project, so that the same layer is loaded twice

6. import the style from from point 4 and assign it to the second layer

7. save qgis project file

8. open the project file in text editor --> all rule keys now exist twice.


Now my question: will we run into problems because of these duplicated rule keys? If this is a problem - why is QGIS not taking care about making the rule ids unique by generating new uuid keys on importing the qml style file? Is this a bug in QGIS? Or are all of these rule keys totally irrelevant? If they are irrelevant, why do they exist in the project?

Thanks for the discussion,

Andreas


_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: How important are rule ids (keys) in QGIS project files?

Martin Dobias
Hi Andreas

On Wed, Jun 12, 2019 at 11:00 AM Andreas Neumann <[hidden email]> wrote:
>
> Now my question: will we run into problems because of these duplicated rule keys? If this is a problem - why is QGIS not taking care about making the rule ids unique by generating new uuid keys on importing the qml style file? Is this a bug in QGIS? Or are all of these rule keys totally irrelevant? If they are irrelevant, why do they exist in the project?

Rule key IDs are there to identify rules within a single layer. A rule
key being repeated in a different layer should do no harm. From what I
recall, the reason behind having rule keys is mainly to be able to
have unique identification for legend - e.g. if user enables or
disables a rule, we know which one it is based on the rule key
(otherwise we would need to use indexes of rules which are likely to
change when rules get added/removed/rearranged).

Hope that helps....

Cheers
Martin
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: How important are rule ids (keys) in QGIS project files?

Andreas Neumann-4

Hi Martin,

Thanks a lot. This is useful information to me.

Andreas

On 2019-06-17 12:11, Martin Dobias wrote:

Hi Andreas

On Wed, Jun 12, 2019 at 11:00 AM Andreas Neumann <[hidden email]> wrote:

Now my question: will we run into problems because of these duplicated rule keys? If this is a problem - why is QGIS not taking care about making the rule ids unique by generating new uuid keys on importing the qml style file? Is this a bug in QGIS? Or are all of these rule keys totally irrelevant? If they are irrelevant, why do they exist in the project?

Rule key IDs are there to identify rules within a single layer. A rule
key being repeated in a different layer should do no harm. From what I
recall, the reason behind having rule keys is mainly to be able to
have unique identification for legend - e.g. if user enables or
disables a rule, we know which one it is based on the rule key
(otherwise we would need to use indexes of rules which are likely to
change when rules get added/removed/rearranged).

Hope that helps....

Cheers
Martin



_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer