3

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,
                                     return_values=return_Vals)
arcpy.conversion.LasDatasetToRaster(dem_layer, outname, "ELEVATION", "BINNING AVERAGE LINEAR", "FLOAT", "CELLSIZE", 10, 1)
arcpy.Delete_management(dem_layer)

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.

0

The environment property mask from the env class is neither supported in Make LAS Dataset Layer nor is it in Las Dataset To Raster (see their corresponding 'Environments' section).

On the other hand, an alternative is t use Extract by Mask to clip the output from from Las Dataset To Raster. For example:

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")
outExtractByMask.save("clipped_dem")

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

arcpy.env.mask = "myMask"
outExtractByMask = ExtractByMask("dem")
outExtractByMask.save("clipped_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.