I have a set of different layers (and their respective shapefiles) with information of electric lines. All the layers have the same Fields in their Attribute Tables, but contain information about different features. I want to merge only the layers that I choose and save them into a new QgsVectorLayer (Or something similar).
To get all of the layers, I'm using this:
lyrs = self.iface.legendInterface().layers()And I want to get something like:
new_layer=lyrs[1]+lyrs[3] new_layer.getFeatures() #Do something else from here, but is irrelevant to the question(Obviously that last part won't work because "TypeError: unsupported operand type(s) for +: 'QgsVectorLayer' and 'QgsVectorLayer'", but that is the idea of what I need to get)
Some details:
1: I would prefer a method that does not create a new shapefile like "qgis:mergevectorlayers" (The method will be called multiple times, and it would create a lot of unnecesary shapefiles)
أكثر...
To get all of the layers, I'm using this:
lyrs = self.iface.legendInterface().layers()And I want to get something like:
new_layer=lyrs[1]+lyrs[3] new_layer.getFeatures() #Do something else from here, but is irrelevant to the question(Obviously that last part won't work because "TypeError: unsupported operand type(s) for +: 'QgsVectorLayer' and 'QgsVectorLayer'", but that is the idea of what I need to get)
Some details:
1: I would prefer a method that does not create a new shapefile like "qgis:mergevectorlayers" (The method will be called multiple times, and it would create a lot of unnecesary shapefiles)
أكثر...