I need to create a script in QGIS which stores outputs. In this case, official documentation didn't help to me.

When I use geoprocessing (processing.runalg()) for vector layers. In some cases, output is selection of the input vector (eg. select by location) and in other cases, output is a vector layers (eg. split by lines with lines).

How do I save both types of outputs as:

  1. new memory layer;
  2. new shapefile saved on disk?

closed as off-topic by PolyGeo Nov 15 '17 at 12:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Could you post your current script to allow potential answerers to help please? :) – Joseph May 28 '15 at 11:46
  • When I try to create new layer from extracting by attribute: processing.runalg("qgis:extractbyattribute",landuse,"Landuse",0,3,riverbed) where riverbed is the output argument and I don't know, how to properly use it, when I want to create new memory/shapefile layer from it. – dabraham May 28 '15 at 12:11
  • I'm not too experienced in this but perhaps try: processing.runalg("qgis:extractbyattribute",landuse,"Landuse",0,3,"memory:riverbed") or even processing.runandload("qgis:extractbyattribute",landuse,"Landuse",0,3,"memory:riverbed") – Joseph May 28 '15 at 12:13
  • It returns this error: Traceback (most recent call last): File "<input>", line 1, in <module> IndexError: list index out of range – dabraham May 28 '15 at 12:32

Browse other questions tagged or ask your own question.