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?

1 Answer 1


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:

  • Make sure you have cmake; use your favorite package manager to install
  • Download points2grid from Github: 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 to sudo 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 above

  • Write a pipeline xml file to describe your gridding process (run points2grid --help for more information about the points2grid options):

    <?xml version="1.0" encoding="utf-8"?>
    <Pipeline version="1.0">
     <Writer type="writers.p2g">
      <Option name="grid_dist_x">6.0</Option>
      <Option name="grid_dist_y">6.0</Option>
      <Option name="filename">outfile</Option>
      <Option name="output_type">mean</Option>
      <Option name="output_type">idw</Option>
      <Option name="output_format">grid</Option>
      <Reader type="readers.las">
       <Option name="filename">mylasfile.las</Option>

  • Use pdal pipeline to create your DEM:

    pdal pipeline mypipeline.xml

That should create some outfile.xxx raster files.

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.