I am using ArcPy to convert large batches of LAS files to GeoTIFF format. It seems like a lot of the data I have acquired from a particular source is giving me the same error: I am able to convert the LAS file to a LAS Dataset in Arc, but the conversion to TIFF usually writes out to an empty TIFF (i.e. I pull the resulting TIFF into a viewer software and there is no terrain data stored in it, just a blank screen.)
What's really weird is that all of these erroneous files have the same size, ~1300kb, so there's SOMETHING there, just not the data that should be written out into it.
If I process them manually - without automating the process with ArcPy - they come out fine, but I am processing thousands and thousands of these tiles so this is just not sustainable for the project I am working on.
This problem is only with data that I have downloaded for Virginia, I have been able to process other states' data with the same code without any problems.
import os import arcpy import glob import shutil from arcpy import env arcpy.CheckOutExtension("3D") #ws (workspace) is the location of the LAS files that I would like to #process. I am running the script from a location other than this folder #containing the LAS files, however the LAS files and resulting LASD and TIFs #will remain in the same location, unless an exception is thrown and the #files are moved by my script. ws = "list of LAS files" os.chdir("working directory") #inLas uses glob to specify all files in the ws folder with the .las #extension will be processed. inLas = glob.glob(os.path.join(ws, '*.las')) #This first loop goes through the entire list of las files and creates a LASD #file for them using the ArcPy CreateLasDataset tool. Since I was having #trouble with some of the LAS files during this step I added an 'except' #block that moves any files that this step fails on to another folder. for las in inLas: try: arcpy.CreateLasDataset_management(las) except: print "Error with " + las shutil.move(las,"Folder for segregating erroneous files") #This next loop is just a repeat of the first loop, but this time I am #taking all of the resulting files with the .lasd extension and using the #ArcPy 'LASD to Raster'tool. inLasDataset = glob.glob(os.path.join(ws, '*.lasd')) for lasd in inLasDataset: try: lasdLayer = arcpy.MakeLasDatasetLayer_management(lasd, class_code=[1,2,9]) arcpy.LasDatasetToRaster_conversion(lasdLayer, sampling_value=1) except arcpy.ExecuteError: print "Error with " + lasd shutil.move(lasd,"Folder for segregating erroneous files") print "Done"