I'm creating LiDAR-derived DEMs for multiple different sites. Each site has a different project boundary (clip_shp) and they all share the same lake break lines I'm using for hydro flattening (replace_shp).
I've built the following function to build the necessary value table to feed into a step involving arcpy.management.CreateLasDataset() so that the project boundary is used to Soft Clip the DEM, and the lakes are used as Soft Replace surfaces.
def build_value_table(clip_shp: Path, replace_shp: Path):
"""Return arcpy.ValueTable ready for in_surface_constraints."""
vt = arcpy.ValueTable()
if clip_shp.exists():
vt.addRow([str(clip_shp), "<None>", "softclip"])
print(f" added clip constraint: {clip_shp}")
else:
print(f" clip shapefile missing – skipped: {clip_shp}")
if replace_shp.exists():
vt.addRow([str(replace_shp), "Shape", "softreplace"])
print(f" added replace constraint: {replace_shp}")
else:
print(f" replace shapefile missing – skipped: {replace_shp}")
return vt The las dataset is created as follows:
# 1 create LAS dataset with constraints & statistics
arcpy.management.CreateLasDataset(
input=las_files,
out_las_dataset=lasd_path,
folder_recursion="NO_RECURSION",
in_surface_constraints=vt_constraints,
spatial_reference=sr,
compute_stats="COMPUTE_STATS",
relative_paths="RELATIVE_PATHS"
)The resulting las datasets have the project boundary correctly set as a soft clip surface, but the lakes are also set to Soft Clip, where they should be Soft Replace.
I've tried specifying the number of rows explicitly with vt = arcpy.ValueTable(3) but that leads to worse results (only the project boundary is added but as Anchor Points).
I've hit a wall trying to troubleshoot. Any help / advise is greatly appreciated!