I am trying to create a Digital Earth Model (DEM) using ArcPy under ArcGIS Pro 2, but I am running into some problems.

I can generate a DEM within ArcGIS Pro by selecting only the ground points under LAS files in the LAS dataset properties, but when I try to run the same code within ArcPy, it generates a DEM using all the points.

Any ideas how you select the return point type in ArcPy?

Here is the code that I have used.

arcpy.conversion.LasDatasetToRaster(lasd, "Test_arcpy_dem", "ELEVATION", "BINNING AVERAGE LINEAR", "FLOAT", "CELLSIZE", 10, 1)

As I said, this generates two different outputs, depending if I am in ArcGIS Pro or not.

  • 1
    You need to create a LAS Dataset Layer pro.arcgis.com/en/pro-app/tool-reference/data-management/… to restrict the class codes then use that layer in your LAS dataset to raster. The workflow is the same in desktop resources.arcgis.com/en/help/main/10.2/index.html#//… to create a layer then use that layer in LAS dataset to raster resources.arcgis.com/en/help/main/10.2/index.html#//… Commented May 31, 2018 at 21:34
  • That worked perfectly. If you add your comment as an answer, I will select it.
    – user44796
    Commented Jun 1, 2018 at 15:39
  • 2
    Here is the code that I used based on suggestions from @MichaelStimson. classCodes = [2]; return_Vals = ['Last Return','First of Many','Last of Many','Single Return','1','2','3','4']; dem_layer = arcpy.CreateUniqueName('dem_layer') ## new LAS dataset layer name; arcpy.MakeLasDatasetLayer_management(lasd, dem_layer,class_code=classCodes,return_values=return_Vals); arcpy.conversion.LasDatasetToRaster(dem_layer, "DEM", "ELEVATION", "BINNING AVERAGE LINEAR", "FLOAT", "CELLSIZE", 10, 1); Note: I marked end of line with semi-colon. Not needed.
    – user44796
    Commented Jun 1, 2018 at 17:29
  • Did that work for you? By default return_values is everything so I think that parameter can be omitted, apart from that it looks good. Commented Jun 3, 2018 at 23:32
  • It did work for me. If you post it as the answer, I will upvote it.
    – user44796
    Commented Jun 4, 2018 at 16:17

1 Answer 1


Whether you're working in ArcGIS Pro or Desktop to restrict the class types to ground classes (2 and 8 if present) you need to create a LAS dataset layer:

arcpy.MakeLasDatasetLayer_management(lasd, "LASD_Layer",class_code=[2,8])

which you can use in your LAS dataset to raster function:

arcpy.conversion.LasDatasetToRaster("LASD_Layer", "Test_arcpy_dem", "ELEVATION", "BINNING AVERAGE LINEAR", "FLOAT", "CELLSIZE", 10, 1)

In Desktop: create a LAS dataset layer and LAS dataset to raster.

If you don't already have ground/nonground classes you can use Classify LAS Ground (also in ArcGIS Pro) by Esri or a similar tool to classify ground in your LiDAR point cloud; automatic classification of ground/nonground is usually quite successful, unlike automatic building classification but that's wandering off-topic.

  • How is the last line modified to accept a different interpolation method? I am not sure if that is how it is done but I replaced the BINNING AVERAGE LINEAR with IDW and INVERSE DISTANCE WEIGHTED and got the error ERROR 000622: Failed to execute (LAS Dataset To Raster). Parameters are not valid. ERROR 000628: Cannot set input into parameter interpolation_type. I also tried to determine the accuracy of the dtm using output_prediction_error = True but this gives the error. Any idea how I can work around?
    – User2010
    Commented Jul 10, 2023 at 7:18
  • @Nasa_Milla I'm not sure, I've yet to work directly with ArcGIS Pro, perhaps try adding a void fill method as per the docs pro.arcgis.com/en/pro-app/latest/tool-reference/conversion/… "IDW NATURAL_NEIGHBOR" sounds like it would work. Commented Jul 12, 2023 at 0:58
  • Thanks for your feedback. I modified the interpolation method to BINNING IDW LINEAR and it now works.
    – User2010
    Commented Jul 17, 2023 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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