I am implementing a C++ application that must produce DEMs from LIDAR data. I am following the next workflow:
- Write .las files from lidar data.
- Use PCL algorithms to transform/filter the point cloud.
- Use GDAL/OGR to create the raster/grid.
- Create a 3D model (.obj) from raster.
In this process I am doing the next file conversions:
- From ".las" to ".pcd" (To work with PCL).
- From ".pcd" to "vector format" (i.e. "ESRI Shapefile") (To work with GDAL).
- From "vector format" to "raster format" (i.e. ".tif") (To generate the DEM).
- From "raster format" to ".obj" (To visualize the DEM in 3D).
I'm using gdal_grid to create the grid from vector format file and gdal_dem to create the DEM using GDAL interpolation algorithms.
I'm not sure If this is the best way to create a DEM from .las files. I want to use third-party libraries to transform, filter or interpolate the point cloud and PCL/GDAL have these tools.
Anyone with experience with DEMs can give me information / advice?
Best Answer
If you're comfortable building software from source and are on a Unix flavor or OSX, you can go from .las to DEM using PDAL and points2grid. If you're on Windows, I have no idea if you'll be able to get points2grid to build, but you could try.
Both PDAL and points2grid have C++ APIs that you could integrate into your own C++ application. You can also use PDAL's command line executable to create DEMs.
The short instructions for a Unix/OSX system to get a points2grid-enabled PDAL command-line executable are:
git clone https://github.com/CRREL/points2grid.git
Build and install points2grid:
cd points2grid && cmake . && make && make install && cd ..
If you don't have write access to
/usr/local
, change that last bit tosudo make install
Download PDAL from Github:
git clone https://github.com/PDAL/PDAL.git
Build and install PDAL with points2grid support:
cd PDAL && cmake . -DBUILD_PLUGIN_P2G=ON && make && make install && cd ..
Same caveat to
make install
as aboveWrite a pipeline xml file to describe your gridding process (run
points2grid --help
for more information about the points2grid options):Use
pdal pipeline
to create your DEM:pdal pipeline mypipeline.xml
That should create some
outfile.xxx
raster files.