I am trying to load a directory full of zipped GML files (*.gz) into QGIS using pyqgis' iface.addVectorLayer(), but as the GML file contains multiple separate vector layers (Area, Text, Symbol, Point and Line), the "Select vector layers to add" dialog box comes up for each GML in the folder. This means that rather than saving me time by loading all the files in at once, I would still have to click on the dialog box for every layer in the folder.
The ideal situation is that all of the vector layers within each GML are added into QGIS without any manual intervention. How does one select all of the vector layers in the dialog and add them to the gui without manual intervention?
I'm running this from the python console within QGIS.
import os
for r, d, fi in os.walk(path):
for f in fi:
iface.addVectorLayer(os.path.join(r, f), f, "ogr")
No comments:
Post a Comment