I have a data-set of .tif satellite images and .geoJSON labels corresponding to them. I am trying to iterate over the satellite images,plot the geoJSON labels and save them as .jpeg images.
However,only the first image is being saved correctly.The others are either completely blank or have very little of the original .tif image on them. I am very new to QGIS.
Here is my code
for el in [1,3,4,7,8,9]:
iface.addRasterLayer("Path/RGB-PanSharpen_AOI_2_Vegas_img"+str(el)+".tif", "Image") #Adding Image
iface.addVectorLayer('Path/buildings_AOI_2_Vegas_img'+str(el)+'.geojson','Label','ogr') #Adding labels
eMenu =iface.viewMenu()
eMenu.actions() [11].trigger() #Zooming in to layer
iface.mapCanvas().saveAsImage("Desktop\Im"+str(el)+".jpeg",None,"jpeg") #Saving
QgsMapLayerRegistry.instance().removeAllMapLayers() #Clearing canvas
I am using QGIS 2.14.20-Essen
eMenu.actions() [11].trigger() #Zooming in to layer
has a space before the zoom level – Hugo Roussaffa - GeoDatup Nov 3 '17 at 11:27