Tuesday, 22 March 2016

Batch processing LiDAR files (.las to raster) with PyQGIS?


for layers in glob.glob("*.las"):
processing.runalg("grass7:r.in.lidar", "input_las",5,1,"",1,100,"","",5,"","",False,True,True,"331289.57265,337990.42735,4558790.0,4560890.0",0,layers+"E:/las_new/.tif")



{'output': 'PNOA_2016_CAT_huso31_346-4560.lasE:/las_new/.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4562.lasE:/las_new/.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4564.lasE:/las_new/.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4566.lasE:/las_new/.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4568.lasE:/las_new/.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4570.lasE:/las_new/.tif'}
output_ras=("E:/las_Ras")



for layers in glob.glob("*.las"):

processing.runalg("grass7:r.in.lidar", "input_las",5,1,"",1,100,"","",5,"","",False,True,True,"331289.57265,337990.42735,4558790.0,4560890.0",0,layers+"output_ras.tif")


{'output': 'PNOA_2016_CAT_huso31_346-4560.lasoutput_ras.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4562.lasoutput_ras.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4564.lasoutput_ras.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4566.lasoutput_ras.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4568.lasoutput_ras.tif'}
{'output': 'PNOA_2016_CAT_huso31_346-4570.lasoutput_ras.tif'}




for layers in glob.glob("*.las"):
processing.runalg("grass7:r.in.lidar", "input_las",5,1,"",1,100,"","",5,"","",False,True,True,"331289.57265,337990.42735,4558790.0,4560890.0",0,"output_ras.tif")


{'output': 'output_ras.tif'}
{'output': 'output_ras.tif'}
{'output': 'output_ras.tif'}
{'output': 'output_ras.tif'}
{'output': 'output_ras.tif'}
{'output': 'output_ras.tif'}




I would like to batch process many LAS files to rasters using the PyQGIS algorithm. As you can see in the code, I think the final problem is with the output. It does not write the files out to my defined output pathway as tif files. Also how can I make sure the naming of output rasters are according to the original LAS they are generated from? What am I doing wrong here? Not a pro at Python. Started 3 days ago.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...