My algorithm needs a temporary layer in a QGIS processing script. I can use regular pyqgis api to create a temporary layer but want to know if there is a preferred and processing-specific way of doing it. Since processing already creates a temporary directory for the output, can it be used for creating another layer? Can I use processing.core.Vectorwriter or some other helper method?
Edit: I use the following right-now and looking for something more processing-specific and preferably writing to processing temporary dir instead of a memory layer.
templayer = QgsVectorLayer('Polygon?crs=%s' % input_layer.crs().authid(), 'temp', 'memory') dataProvider = templayer.dataProvider() templayer.startEditing() dataProvider.addFeatures([features]) templayer.commitChanges() templayer.updateExtents()