Monday, 3 August 2015

dem - Selecting LiDAR return point type in LiDAR dataset with ArcPy?


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.



Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...