alivesilikon.blogg.se

Lidar to raster grass gis
Lidar to raster grass gis






from WBT.whitebox_tools import WhiteboxTools Methods will interpolate all of the LAS files in the workingĭirectory, e.g. Parameters are left unspecified, each of WhiteboxTool's LiDAR gridding Inclined to write a Python script that calls the above function forĮach input file contained within a folder. When you have hundreds, or even thousands, of LAS files you might be If you are simply looking to interpolate all of the LAS files contained in a folder using Python, then I can suggest the following four-line solution, taken from the the section titled ' I have many LAS files and want to interpolate all of them at once' in the WhiteboxTools tutorial on intepolating LiDAR: 'grass74 -text -f E:\\Rohan\\Heimdall\\grassdata\\lidar\\PERMANENT -exec r.in.lidar -e -n -o -overwrite -verbose input= -exec '.format(grassbat, grass_location) + commandĪs an aside, the line for files in las_file_list: might be clearer as for file (singular file) since you are referring to one file at a time. This is just one.īased on that, but not on having tried to run the code, I think your function should probably look something like this: def las_to_GTIFF_lidardata(input_las, grass_location, output_directory): NB there are lots of ways to do 'string interpolation' in Python. You're also putting variable names in strings, when you do this python doesn't know they're variables so won't insert the value you want. Batch processing LiDAR files (.las to raster) with PyQGIS?.Īt a general level I think you're probably using lists to get around string formatting/interpolation, but you're not turning them back into strings.

#Lidar to raster grass gis code#

PyQGIS code for r.in.lidar in pyQGIS for LiDAR DEM output?.Batch scripting r.in.lidar in pyQGIS for LiDAR DEM output?.I also have tried using pyQGIS but without success: Las_to_GTIFF_lidardata(input_las=input_las, grass_location=grass_location, output_directory=output_directory) ,#brackets needed?Ĭommand_final = + command , # removed + files here as only str is taken not list Out_tif = os.path.join(output_directory, tif_file_name) Tif_file_name = os.path.basename(files) + '.tif'

lidar to raster grass gis

Las_file_list = glob.glob(input_las + '\\*.las') # lists all files in folder that (*.las) But lists files with odd slash pattern e.g'E:/Rohan/Heimdall/data/LAS\\PNOA_2016_CAT_huso31_346-4562.las'ĭef las_to_GTIFF_lidardata(input_las, grass_location, output_directory):

lidar to raster grass gis

Path = "E:/Rohan/Heimdall/data/LAS/*.las" Grass_location = r'E:\Rohan\Heimdall\grassdata\lidar\PERMANENT' # r' reads a path as a raw string Output_directory = r'E:\Rohan\Heimdall\data\Raster\GRASS' Input_las = r'E:\Rohan\Heimdall\data\LAS' Grassbat = r'C:\Program Files\QGIS 3.0\bin\grass74.bat' #not needed as the os dir is changed Os.chdir(r'C:\Program Files\QGIS 3.0\bin') Please have a look at the code and suggest a work around. The loop runs but at the end I get an arg must be string not list error. I have a loop in Python to list out LAS files in a folder, and run two commands in Grass GIS on these files to write them out as rasters.






Lidar to raster grass gis