[Qgis-user] QGIS 3 Processing question
Frank Broniewski
hallo at frankbroniewski.com
Sun Jul 1 23:33:13 PDT 2018
Hi Rudi,
thanks a lot for your answer, I will definitely try that out. And once I’ve done it I will post my insights for future reference. I tried the QgsProcessingParameterVectorDestination already, but
> Finally, in your `params` dict, change the value for OUTPUT from `memory:` to `output`
This is really new to me. Where did you find that? I really searched the docs up and down and gis.stackexchange as well, but never came across an output output for the output 😃
Many thanks,
Frank
Von: Rudi von Staden <rudivs at gmail.com>
Gesendet: Sonntag, 1. Juli 2018 15:56
An: Frank Broniewski <hallo at frankbroniewski.com>
Cc: qgis-user <qgis-user at lists.osgeo.org>
Betreff: Re: [Qgis-user] QGIS 3 Processing question
Hi Frank,
On Fri, 29 Jun 2018 at 09:35, Frank Broniewski <hallo at frankbroniewski.com <mailto:hallo at frankbroniewski.com> > wrote:
Anyway, my testing-algorithm-script is still not working. It runs through, but I do not get the expected result loaded into the layer tree. I suppose it runs through - the output from the 'qgis:pointsalonglines' is a QgsVectorLayer - but after finishing I get nuthink back.
I had a similar problem. I think it's because the template defines the output as a feature sink, so you assume you have to use the same. I think if you change your definition from:
self.addParameter(
QgsProcessingParameterFeatureSink(
self.OUTPUT,
<http://self.tr/> self.tr('Center line')
)
)
to:
self.addParameter(
QgsProcessingParameterVectorDestination(
self.OUTPUT,
self.tr <http://self.tr> ('Center line')
)
)
and then in processAlgorithm you need to add output as a layer you can work with:
output = self.parameterAsOutputLayer(parameters,self.OUTPUT,context)
Finally, in your `params` dict, change the value for OUTPUT from `memory:` to `output`.
The new syntax is more complicated than it used to be, and it takes some time to wrap your head around it. I do find that it gets easier once you've got a couple of scripts under your belt.
Rudi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180702/ce878325/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5488 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180702/ce878325/attachment.bin>
More information about the Qgis-user
mailing list