I have an irregular LiDAR point cloud dataset, so when I try to create a DEM or DSM, the points are connected across the irregular edges of the LiDAR point cloud.

I thought that creating a mask would help, but this doesn't seem to work. Here is my example code:

lasd = "mylasd.lasd"
arcpy.env.mask = "myMask" ## this is boundary of LiDAR point cloud
outname = "dem"
dem_layer = arcpy.CreateUniqueName('dem_layer')
arcpy.MakeLasDatasetLayer_management(lasd, dem_layer,class_code=classCodes,
arcpy.conversion.LasDatasetToRaster(dem_layer, outname, "ELEVATION", "BINNING AVERAGE LINEAR", "FLOAT", "CELLSIZE", 10, 1)

Using the mask doesn't result in any difference. Is the correct way to create the DEM and then, crop it? This seems more time-intensive, so I want to avoid this step if possible.


As stated by Michael Stimson's comment the environment property mask from the env class is not supported in any of these tools: Make LAS Dataset Layer and Las Dataset To Raster (see the 'Environments' section in their corresponding help pages).

As suggested, the alternative is to use Extract by Mask to clip the resulted raster from Las Dataset To Raster:

import arcpy
from arcpy import env
from arcpy.sa import * ## Extract by Mask tool

arcpy.env.workspace = 'C:/data'
arcpy.conversion.LasDatasetToRaster("mylasd.lasd", "dem.tif", "ELEVATION", "BINNING AVERAGE LINEAR", "FLOAT", "CELLSIZE", 10, 1)

outExtractByMask = ExtractByMask("dem", "myMask")

Note ExtractByMask supports the environment setting arcpy.env.mask, if one wants to use it:

arcpy.env.mask = "myMask"
outExtractByMask = ExtractByMask("dem")

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.