I was wondering if there is a way to merge multiple layers. I actually would like to merge all layers in the registry programmatically, all of them are point layers and have the same fields. I have thinking I might copy all features from all layers and paste them into a new vector layer... but I believe there should be an easier option. What do you think?? Would that be possible?
2 Answers
you can call a process like the merge function programmatically in python:
import processing
processing.runalg('qgis:mergevectorlayers', layer1, layer2, savename)
-
2Right, and do it in a for loop with layer1 always being the already merged layer. Feb 6, 2015 at 4:08
MMQGIS plugin have your merge funcion... other merge funcion can be found in Processing/gdal Processing/saga
but MMGIS works as you aspected
-
Thanks Luigi!! I know there are some tools that allow me to do that, the problems is how to do it programmatically. I'd need to include all layers in the registry (created in previous processes, in "memory" most of them), load those plugins and merge tools into my code and get the wanted layer... I don't know if that's possible, I will keep pushing– Luis EteOct 8, 2014 at 10:18