[QGIS-Developer] multipartToSingleParts via code

Ben Hur Pintor bnhr.dev at gmail.com
Tue Jun 13 23:51:17 PDT 2017


What do you mean by *"The plugin runs correctly only the FIRST time.*
*Then, when it finishes, if I run again the plugin choosing an input2
vectorlayer, the processing algorithm doesn't see the input2 and my ouput
remains output1."? *

Are you calling the algorithm inside a loop? May I have a look at your
code? Maybe the issue is in the Python code and not necessarily on QGIS.

I usually use *processing.runandload()* because it automatically adds the
resulting layer.

Regards,

Ben Hur

On Tue, Jun 13, 2017 at 5:31 PM, Stefano Masera <
stefano.masera at arpa.piemonte.it> wrote:

> Thanks Nyali.
> The reason is that if I use processing it doens't work correctly.
> In details, if I write:
>
> import processing
> processing.runalg("qgis:multiparttosingleparts", input1, output1)
>
> The plugin runs correctly only the FIRST time.
> Then, when it finishes, if I run again the plugin choosing an input2
> vectorlayer, the processing algorithm doesn't see the input2 and my ouput
> remains output1.
> It's crazy!
> It's something like a bad refresh..
>
> If you have another solution....
>
> Thank you very much.
>
> Stefano
>
>
> ------------------------------
> *Da: *"Nyall Dawson" <nyall.dawson at gmail.com>
> *A: *"Stefano Masera" <stefano.masera at arpa.piemonte.it>
> *Cc: *"qgis-developer" <qgis-developer at lists.osgeo.org>
> *Inviato: *Martedì, 13 giugno 2017 10:20:31
> *Oggetto: *Re: [QGIS-Developer] multipartToSingleParts via code
>
> On 13 June 2017 at 17:49, Stefano Masera
> <stefano.masera at arpa.piemonte.it> wrote:
> > Hi Nyali,
> > in a few words I want to do a multipartToSingleParts (for a VectorLayer)
> via
> > code without using the processing module.
>
> Any particular reason why?
>
> In any case, I'd suggest copying the code used by processing:
> https://github.com/qgis/QGIS/blob/release-2_18/python/
> plugins/processing/algs/qgis/MultipartToSingleparts.py#L66
>
> Nyall
>
> --
> Questo messaggio e' stato analizzato ed e' risultato non infetto.
> This message was scanned and is believed to be clean.
>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
---

*Engr. Ben Hur S. Pintor*
*Research Associate*
Phil-LiDAR 2 Project 5: REMap
UP Training Center for Applied Geodesy and Photogrammetry


*Juris Doctor*
College of Law
*University of the Philippines Diliman*
Quezon City 1101, PHL
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170614/f49c5868/attachment-0001.html>


More information about the QGIS-Developer mailing list