I need to use qgis:union in pyqgis algorithm and to merge 2 layers, layer1 and layer2 and "see" the output layer But i don´t understand how to work with the "output layer"

  1. this "output layer" have the layer1 and layer 2 features?
  2. how to save a "output layer"?
  • It really depends on where it runnings (console, console from a script, standAlone application). The processing framework is very useful when you create workflow models but painful in a script. Also Which version of processing you are using ? (It maters for answer) – SIGIS Jun 23 '16 at 5:36

1) Yes and more see the doc

2) To retrieve output 2 possibilities :

  1. if you specify a path of the output it will set it as you mentiion it. ex :


  2. Second solution set the path None and it will write for you in the temp but you need to get it in a variable like so. The variable will be a dictionnary and to get it set the key of the dict.

    prOutput= processing.runalg("qgis:union",layer1,layer2,,None)
    prOutput= {'OUTPUT': u'C:\\Temp\\processingb88b658e8759402daa2ae3e0463e313c\\c92284916d824efcb2aab890c5fed045\\OUTPUT.shp'}  
    prOutput['OUTPUT'] = u'C:\\Temp\\processingb88b658e8759402daa2ae3e0463e313c\\c92284916d824efcb2aab890c5fed045\\OUTPUT.shp'

Not the answer you're looking for? Browse other questions tagged or ask your own question.