0

In this code, each Raster file is downloaded correctly using Python from QGIS. But what I expect is, to merge a delimited text layer onto each raster layer and download it.

import os

myDir = 'D:\\UCC\\Project\\Full_DataWCT\\'  
project = QgsProject().instance()  
layers = [layer for layer in QgsProject.instance().mapLayers().values() if layer.dataProvider().name() == 'gdal']  
pipe = QgsRasterPipe()
                                                                                  
for layer in layers:  
                                  
        pipe.set(layer.dataProvider().clone())  
        pipe.set(layer.renderer().clone())  
        output_path = os.path.join(myDir, '{}.png'.format(layer.name()))  
        file_writer = QgsRasterFileWriter(output_path)  
        file_writer.writeRaster(pipe, layer.width(), layer.height(), layer.extent(), layer.crs(), project.transformContext())  

Code reference - Batch export rasters as rendered images

2
  • Please let me know if my question isn't clear or if I missed something that might be beneficial? Jul 6, 2022 at 18:24
  • The code I copied is provided by you, Maybe you can help @ben-w Jul 6, 2022 at 18:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.