I would like to convert a DEM raster NetCDF file (*.nc) to point cloud LAS file (LAS/LAZ) using Python language. I have been doing the research but still don't have a result. I also have a look on GDAL and PDAL, but there is no specific documents mentioning about this.
1 Answer
Check this out.
This solution works if you have your DEM as TIFF format. But if you can extract the XYZ coordinates from the NetCDF file yourself and save it to a text file, then you can use LAStools to create LAS file. although LAStools is a command line tool but you can use it in python:
def convert_txt_to_las(txt_path, out_las_path):
command = 'txt2las -parse xyz -i {input_txt} -o {output_las}'
os.system(command.format(input_txt=txt_path, output_las=out_las_path))
-
Hi Parsa! Thank you so so much for your help! I successfully made it :)). Yayyy!– HappierCommented Aug 13, 2021 at 3:26