Skip to main content
2 of 3
the title was lacking 'processing algorithms' and thus was grammaticaly not correct

How to use a memory layer for processing algorithms in QGIS 3

I would like to run a processing algorithms in QGIS3 with a memory vector layer as result.

When I define the memory layer as shown in the following, I get the error Incorrect parameter value for output, while in the Python Error window output is indicated as QgsVectorLayer and nodesLayer.isValid() returns True:

crs = str(inputLayer.crs().authid())
outputLayer = QgsVectorLayer('Point?crs=' + crs , "points", "memory")
processing.run('grass7:v.net',
                {"input":inputLayer,
                 ...
                "output": outputLayer})

If I use a path to the output layer, everything works fine:

outputLayer = r"path_to_file\output.shp"
processing.run('grass7:v.net',
                {"input":inputLayer,
                 ...
                "output": outputLayer})

Any idea on how to correctly create a memory layer in QGIS 3?