Bug report #6218

Loading styles issue

Added by Jonathan Moules over 12 years ago. Updated almost 9 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Symbology
Affected QGIS version:1.8.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:duplicate
Crashes QGIS or corrupts data:No Copied to github as #:15531

Description

This one may be a bit hard to explain.

1) I load a shapefile, it has exactly one attribute column (we'll call it "alpha") it displays fine.
2) I go to style -> Categorised, and click "classify". This gives me a random looking classification, but displays fine.
3) I click "load style", navigate to a style (which is set to a different column "beta"), and click ok. Style loads fine, but all map data disappears.
4) I confirm that the "column" is correct (there's only one column in my shapefile remember).

To get my data showing again, I have to click "classify", then when a box pops up asking me to "confirm delete" I have to click "no". This then makes my data display properly with the correct classification from the loaded file.

I guess this may be because there's only one column in the shapefile (which is different), but it may also happen if the style column is the first of a set of columns in a shapefile.

History

#1 Updated by Paolo Cavallini about 12 years ago

  • Target version set to Version 2.0.0

#2 Updated by Jonathan Moules about 12 years ago

If I change the QML file such that:
<renderer-v2 attr="RANDOM_COLUMN_NAME" symbollevels="0" type="categorizedSymbol">
becomes
<renderer-v2 attr="CORRECT_COLUMN" symbollevels="0" type="categorizedSymbol">
and then load it (Step 3), it renders correctly.

(It looks like the bold thing doesn't work for highlighting in those sentences for some reason.

#3 Updated by Jürgen Fischer over 10 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#4 Updated by Médéric RIBREUX almost 9 years ago

  • Status changed from Open to Feedback

Hello, bug triage...

I've made some tests on QGIS 2.13 master and when I load the qml with the wrong column name, every feature got the NULL value style (which is produced by default when using categorized renderer).
This seems correct for me because the style is really applied as it should be: when the column used for categorization is not in the layer, use the null value style. Of course, if you have deleted the null value before exporting to qml, nothing is rendered.

So, if you want to have categorized styles that are "portable", you need to be careful to export the style with a NULL value class.

I think that QGIS should not try to automatically find the best column candidate because it could create some undetected errors (the class are not the same, some geometries are not correctly displayed because they don't belong to a class, etc.).

Can we close this bug ?

#5 Updated by Giovanni Manghi almost 9 years ago

  • Resolution set to duplicate
  • Status changed from Feedback to Closed

seems also somehow duplicate of #3775

Also available in: Atom PDF