<div dir="ltr"><div>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).</div><div><br></div><div>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.</div><div><br></div><div>Cheers,</div><div><br></div><div>Olivier<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 12, 2018 at 6:22 PM Nyall Dawson <<a href="mailto:nyall.dawson@gmail.com">nyall.dawson@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, 12 Sep 2018 at 04:00, C Hamilton <<a href="mailto:adenaculture@gmail.com" target="_blank">adenaculture@gmail.com</a>> wrote:<br>
><br>
> In a processing routine I create an output vector layer.<br>
><br>
>         self.addParameter(<br>
>             QgsProcessingParameterFeatureSink(<br>
>                 self.PrmOutputLayer,<br>
>                 tr('Output layer'))<br>
>             )<br>
><br>
>         (sink, dest_id) = self.parameterAsSink(parameters,<br>
>             self.PrmOutputLayer, context, fields, QgsWkbTypes.LineString, srcCRS)<br>
><br>
> 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?<br>
<br>
Actually the best approach is to use a layer post processor. This is<br>
flexible and totally thread-safe :)<br>
<br>
I don't think there's any Python examples in QGIS yet, but see<br>
<br>
<a href="https://github.com/qgis/QGIS/blob/master/src/analysis/processing/qgsalgorithmcategorizeusingstyle.cpp#L104" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/blob/master/src/analysis/processing/qgsalgorithmcategorizeusingstyle.cpp#L104</a><br>
<br>
and<br>
<br>
<a href="https://github.com/qgis/QGIS/blob/master/src/analysis/processing/qgsalgorithmimportphotos.cpp#L227" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/blob/master/src/analysis/processing/qgsalgorithmimportphotos.cpp#L227</a><br>
<br>
for some c++ examples.<br>
<br>
Here's a possible Python example:<br>
<br>
<a href="https://gist.github.com/nyalldawson/26c091dd48b4f8bf56f172efe22cf75f" rel="noreferrer" target="_blank">https://gist.github.com/nyalldawson/26c091dd48b4f8bf56f172efe22cf75f</a><br>
<br>
Nyall<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div>