There's the possibility to set styles to the output of a saved model by
right-clicking on it (I think it's the GUI David was mentionning).

I'm not sure but this as well as Matteo's methods rely on external .qml
files, which is not ideal for models portability. It would be a great
addition to be able to embed the styles (actually, other files as well) in
the processing models themselves.

Cheers,

Olivier

On Wed, Sep 12, 2018 at 6:22 PM Nyall Dawson <nyall.daw...@gmail.com> wrote:

> On Wed, 12 Sep 2018 at 04:00, C Hamilton <adenacult...@gmail.com> wrote:
> >
> > In a processing routine I create an output vector layer.
> >
> >         self.addParameter(
> >             QgsProcessingParameterFeatureSink(
> >                 self.PrmOutputLayer,
> >                 tr('Output layer'))
> >             )
> >
> >         (sink, dest_id) = self.parameterAsSink(parameters,
> >             self.PrmOutputLayer, context, fields,
> QgsWkbTypes.LineString, srcCRS)
> >
> > I would like to style the output layer by enabling a label based off of
> one of the fields. Can I do this in Processing? I guess what I would like
> to get is the actual vector layer that is created. Is that possible?
>
> Actually the best approach is to use a layer post processor. This is
> flexible and totally thread-safe :)
>
> I don't think there's any Python examples in QGIS yet, but see
>
>
> https://github.com/qgis/QGIS/blob/master/src/analysis/processing/qgsalgorithmcategorizeusingstyle.cpp#L104
>
> and
>
>
> https://github.com/qgis/QGIS/blob/master/src/analysis/processing/qgsalgorithmimportphotos.cpp#L227
>
> for some c++ examples.
>
> Here's a possible Python example:
>
> https://gist.github.com/nyalldawson/26c091dd48b4f8bf56f172efe22cf75f
>
> Nyall
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to