[QGIS-Developer] Why is the processing method outputWkbType() called by QGIS outside of the algorithm

C Hamilton adenaculture at gmail.com
Thu Sep 9 06:35:19 PDT 2021


I updated a number of my Shape Tools plugin routines to
QgsProcessingFeatureBasedAlgorithm. One of the methods is outputWkbType
which returns the WKB type. For my algorithm that type is determined by
parameters selected when the user runs the algorithm. The variable used to
determine the output type was initialized when the user runs the algorithm.
This worked fine with the LTR release, but I found that when the user
clicks in the Locator service text area in QGIS 3.20, QGIS is querying all
of the outputWkbType() processing methods and was causing an exception
because I had not initialized the variable yet.

I don't know what the output wkb type is going to be until the user runs
the algorithm, so why is QGIS spuriously calling all the processing
algorithm outputWkbType() methods in QGIS 3.20. Apparently, it also happens
when "edit in place" is active. If this is truly how you intend this to
operate, then it would be good to include a note in the API documentation
that this method can be called by QGIS and to make sure it can return a
valid entry by initializing any variables in initParameters(). If this
behavior is a bug, let me know and I will put in a ticket.

Thanks,

Calvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210909/46fa7758/attachment.html>


More information about the QGIS-Developer mailing list