Follow up question to QGIS Model Builder Script - Possible to merge layers in a folder?

I think I'm missing something very obvious here but can't seem to find it. After merging shapefiles in a folder, I would like a grid to be created. However, I am unsure how to call the result of the merged file into the grid function.

## Test=name
## Select_Directory=folder
## cellsize=number 1000
## grid=output vector

import os
import glob

output = glob.glob('./*.shp')
Layer_0 = output[0]

processing.runalg("saga:mergeshapeslayers",  Layer_0, ";".join(output))    
processing.runalg("qgis:creategrid", cellsize, cellsize, 24108, 18351, 258293, 665638, 1, 'EPSG:7405', grid)

Processing already has a tool to create grids from an input layer. I therefore suggest to create a model using your join tool followed by the grid creation tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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