Feature request #17961

Allow algorithms to set style and layer options for outputs

Added by Paolo Cavallini over 1 year ago. Updated over 1 year ago.

Status:Closed
Priority:Low
Assignee:Victor Olaya
Category:Processing/Core
Pull Request or Patch supplied:No Resolution:fixed/implemented
Easy fix?:No Copied to github as #:25857

Description

The "Add unique value field index" algorithm generates a code for each category. Optionally now https://github.com/qgis/QGIS/pull/6132 it creates a summary table mapping the new categories to their original values.
It would be good to automatically add in the layer property style the summary table as Value map.
This relates to the more general issue of automatically applying an appropriate style to the output of some commands (e.g. a greyscale for aspect, etc.).
This is the approach used by GRASS since long.


Related issues

Related to QGIS Application - Feature request #10146: Add appropriate colour ramps to results of analyses Closed 2014-05-01

Associated revisions

Revision bd1d87ed
Added by Nyall Dawson over 1 year ago

[processing] Allow algorithms to set layer post-processors for
execution on generated layers after the algorithm (or parent
model) completes

This commit adds an interface for layer post-processing handlers
for execution following a processing algorithm operation.

Post-processing of a layer will ONLY occur if that layer is set
to be loaded into a QGIS project on algorithm completion.

Algorithms that wish to set post-processing steps for generated
layers should implement this interface in a separate class
(NOT the algorithm class itself!) and implement a method
to handle the layer post-processing.

This method always runs in the main thread and can be used to
setup renderers, editor widgets, metadata, etc for the given layer.

Fixes #17961

History

#1 Updated by Alexander Bruy over 1 year ago

IMHO assigning style and widgets should not be done auotmatically. Also this is huge maintenance task, as we have more than 300 algorithms in default setup and will need to add and keep updated styles for every output in every algorithm.

If user wants to apply custom styles to the results, there is a possibility to do this.

#2 Updated by Alexander Bruy over 1 year ago

#3 Updated by Paolo Cavallini over 1 year ago

IMHO the GRASS approach makes sense: add automatically the style when meaningful (e.g. aspect on a greyscale, etc.). In this way the task is far smaller.

#4 Updated by Nyall Dawson over 1 year ago

IMHO assigning style and widgets should not be done auotmatically. Also this is huge maintenance task, as we have more than 300 algorithms in default setup and will need to add and keep updated styles for every output in every algorithm.

I don't think we'd do this by default - what I was thinking was some way to allow algorithms to set metadata for outputs, which could include things like style options to apply to the output layer (if it's set to load back into QGIS).

#5 Updated by Nyall Dawson over 1 year ago

  • Subject changed from Add Value map from categories to Allow algorithms to set style and layer options for outputs

#6 Updated by Arnaud Morvan over 1 year ago

  • Tracker changed from Bug report to Feature request

#7 Updated by Paolo Cavallini over 1 year ago

Expanded from #10146, now set as duplicate

#8 Updated by Nyall Dawson over 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

#9 Updated by Giovanni Manghi over 1 year ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF