2

I try to run a QGIS plugin in QGIS 3.4 that uses processing to execute algorithms in a row:

    params_snap = {
        'input' : input,
        'type' : 1,
        'tool' : 1,
        'threshold' : 0.000095,
        'output': 'memory:',
        'error' : error,
        'GRASS_OUTPUT_TYPE_PARAMETER' : 2
    }

    snap = processing.runAndLoadResults('grass7:v.clean', params_snap)

    params_break = {
        'input': snap['output'],
        'type': 1,
        'tool': 0,
        'threshold': 0,
        'output': output,
        'error': error,
        'GRASS_OUTPUT_TYPE_PARAMETER': 2
    }

    processing.runAndLoadResults('grass7:v.clean', params_break)

First the v.clean snap algorithm runs. The result is saved in a temporary output layer. This algorithm work without any problems. Afterwards I try to run v.clean break and the input should be the temporarily saved output layer of the first algorithm. But I get the error: Could not load source layer for input: memory: not found.

If I use a filepath instead of 'memory:' in the first output everything works fine and the second algorithm can access the first algorithms output. So I assume that the problem is the 'memory:' statement, but all the sources I found tell to use it.

Edit:

I checked the temporary folder (C:\Users\USER\AppData\Local\Temp\processing_83c42fa467d2461eb67590c719fc22aa\grassdata\temp_location\PERMANENT\vector) and the layer gets successfully created when I run the code. But since it is not located directly in the path C:\Users\USER\AppData\Local\Temp\ I wonder if the path the temporary files are created in is the right one?

2
  • Have you tried assigning a name for the memory layer? Commented Jan 28, 2019 at 13:13
  • Yes, same error. 'memory: name' not found. Commented Jan 28, 2019 at 13:19

1 Answer 1

7

The grass provider does not support QGIS memory layers, so you'll need to give it a path to a real location it can store the temporary result as.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.