[QGIS-Developer] Processing Plugin - Can a feature sink add additional fields afterwords?

C Hamilton adenaculture at gmail.com
Fri Nov 2 14:27:11 PDT 2018


In my KML Tools processing plugin algorithm I create a feature sink as
follows:

(self.sinkPt, self.dest_id_pt) = self.parameterAsSink(self.parameters,
                self.PrmPointOutputLayer, self.context, fields,
                QgsWkbTypes.Point, epsg4326)

'fields' is of type QgsFields which are my predefined field names.As I am
parsing a KML file, I may find that there is extended field data. Is it
possible to add additional fields to my QgsFeatureSink on the fly or do I
need to do a first pass through the data to determine all of the possible
fields?

I am guessing that I will need to preprocess, but that effectively doubles
the time it takes to process the KML and I am trying to make this as fast
as possible.

I could process the entire file to objects in memory and then write them
out, but I don't like doing that in case they are very large files.

Do you have any suggestions?

Thanks,

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


More information about the QGIS-Developer mailing list