Is it possible to automatically (re)classify the data of a layer? (properties-symbology-delete all-classify) Because now I have to do this manually each time my data source changes.

  • You can save the style as QML, and use it when the data source is changed. – ahmadhanb Mar 4 at 10:44

Yes it is possible.

  1. Classify everything you want and when it is okay, save the style as shown below. (I suggest you to use the QGis Layer Style File since you will re use it into QGis)

enter image description here

  1. Open your new layer and Load the created style enter image description here
  • 2
    Hi! Thanks for the quick answer, but I don't see how this could automatically update my layer data when the data source has changed... – bcallewaert Mar 4 at 12:42
  • And it still requires a lot of manual proceedings – bcallewaert Mar 4 at 12:44
  • Hey @bcallewaert, it doesn't need so much manual proceedings. In fact, When you are done with your categorization (this means you have selected a field and you've defined colors based on some conditions), your will save your style. Since other layers should have the same structure, by applying your style it will automatically repeat all what you've done in the first layer – Yannick Arthur DOUNGMO Mar 4 at 13:36
  • Is there a possibility I can contact someone from you through mail so I can show what my problem exactly is? Because now it doesn't fix the problem... – bcallewaert Mar 4 at 14:28
  • 3
    Because when I save the Style, it also copies the value present at that time in the cell. So when the data source is changed and I load in the saved style, the previous value is again shown in the table. This, of course, should not be the case. – bcallewaert Mar 4 at 14:31

You need to write some code to simulate what the GUI is doing. I assume you know at what point your data has changed then you can take a look at Automatic pyqgis categorized renderer classification .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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