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.

1

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 to use Extract by Mask to clip the output DEM from Las Dataset To Raster tool. For example:

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

arcpy.env.workspace = 'C:/data'
arcpy.MakeLasDatasetLayer_management("mylasd.lasd", "ground_lasd", class_code=[2]) # Make LAS Dataset Layer is necessary if the point cloud needs filtering. Here points are filtered per class code 2 (ground points).
arcpy.conversion.LasDatasetToRaster("ground_lasd", "dem.tif", "ELEVATION", "BINNING AVERAGE LINEAR", "FLOAT", "CELLSIZE", 10, 1)

outExtractByMask = ExtractByMask("dem", "myMask.shp") #myMask.shp is the vector boundary of LiDAR point cloud
outExtractByMask.save("clipped_dem")

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

arcpy.env.mask = "myMask.shp"
outExtractByMask = ExtractByMask("dem")
outExtractByMask.save("clipped_dem")
| improve this answer | |

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.