Skip to main content
Tweeted twitter.com/StackGIS/status/1319564251900579840
Tiny adjustments
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148

How to use a Using 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,

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})
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})
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?

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?

Using 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?

the title was lacking 'processing algorithms' and thus was grammaticaly not correct
Link

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

Source Link

How to use a memory layer for 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?