QGis for LIDAR: digital surface model (DSM) with CloudCompare and LAStools

In this article you’ll find the definition of a digital surface model and, step by step, how to create a DSM from an unclassified and classified LIDAR cloud, using CloudCompare and LAStools.

Tutorial : LIDAR HD with QGIS 3.32

1- LIDAR data in QGis 3.32

2- Download LIDAR HD data from IGN and load it into QGis

3- Tools for LIDAR data in QGis 3.32

4-Colorize a point cloud from an orthophoto

5-Colorize from an image with LAStools

6- Digital surface model (DSM) with CloudCompare and LAStools

Digital elevation models

A Digital Elevation Model (DEM) represents a digital version of an existing or virtual object and its surroundings. This can include features such as terrain relief in a specific region. DEM is a global concept that can cover not only the elevation of the terrain, but also all the layers above it, such as vegetation or buildings. When information is limited to terrain elevation, the term Digital Terrain Model (DTM) is used. It provides data on the elevation of each point on the ground. If the information relates to the maximum height above ground in each cell, then the DTM is referred to as a Digital Surface Model (DSM).

Natural landscapes are too complex to model analytically, which means that information is generally based on samples. Ideally, an “authentic” model would also include an interpolation method to obtain elevation values between samples, but this functionality is generally not available to the end user. The specifications of a DEM are also defined using auxiliary data. These specifications, which describe the dataset, are essential to enable users to access, transmit and analyze the data. They encompass several characteristics that are considered essential.

DEM specifications generally comprise two types of parameters. On the one hand, standard elevation specifications do not differ from those of analog maps, and typically encompass geodetic parameters such as ellipsoid, projection, elevation origin, as well as geographic location, such as corner coordinates. The only exception is scale, which has no significance in the context of digital maps. On the other hand, a DEM is a digital product that requires specifications to be interpreted as an elevation grid. These specifications include :

  • Numeric format, including data type (integer, character, real, etc.) and length (usually 2 bytes).
  • The meaning of the numerical values, i.e. the unit of measurement (meter or foot), and in some cases, the coefficients of a conversion law. For example, a linear transformation can adapt values to a specific interval.
  • The structure of the grid, which can be irregular (such as irregular triangular grids or digitized contour lines) or regular (typically a regular grid with square cells).
  • In the case of a regular grid with square cells, which is the most common structure, an important specification is the cell size, although this should not be confused with resolution.

In short, the Digital Elevation Model is a digital representation of the topography of a given area, including objects at height. Its specifications are essential for correctly interpreting the data contained in the model.

The Digital Surface Model (DSM)

The Digital Surface Model (DSM) is a key concept in Geographic Information Systems (GIS) and remote sensing. It represents a digital representation of a terrestrial surface, generally from the ground up to the top of objects present on that surface, such as buildings, trees, etc. The DSM is used to describe the elevation or altitude of the terrain and the objects above it.

Here are a few key points about the Digital Surface Model in GIS:

  • Definition of DSM: The DSM is a three-dimensional mathematical model that associates elevation values with every point on a land surface and all the objects on it, such as buildings, trees, cars, etc. These elevation values can be represented as a percentage of the surface elevation. These altitude values can be represented by points, pixels or meshes, depending on the method used to create the DSM.
  • Data acquisition : Data to create a DSM can be collected from a variety of sources, such as topographic field surveys, satellite or aerial imagery, LiDAR (Light Detection and Ranging) data or other remote sensing techniques. LiDAR surveys are particularly popular for creating high-resolution, high-precision DSMs.
  • MNS applications: The Digital Surface Model is used in a wide range of applications, including land use planning, cartography, natural resource management, ecology studies, urban planning, flood management, civil engineering, communications network planning and more. It provides information on terrain characteristics, building heights, areas at risk of flooding, slope, etc.
  • Differences with the Digital Terrain Model (DTM): It is important not to confuse the DTM with the Digital Terrain Model (DTM). The DTM represents only the surface of the natural terrain, without taking into account objects such as buildings or vegetation. The DTM is generally obtained by removing overhead features, such as buildings and trees, from the DSM.
  • Data processing : Creating a DTM can involve complex data processing to filter out unnecessary points, reduce noise, fill gaps and generate a continuous representation of the terrain. Various processing techniques, such as interpolation, filtering and multi-source data fusion, can be used to create a high-quality DSM.

In a nutshell, the Digital Surface Model (DSM) is a complete digital representation of a land surface, including overhead features such as buildings and trees. It is widely used in GIS for many applications, and provides valuable information on topography and landscape morphology.

Classified or raw data?

Generating a DSM from a LIDAR point cloud can be very simple or more complicated, depending on the type of data used. We’ll confine ourselves here to the two types of data available from IGN: raw data and classified data.

The following image shows a raw point cloud in CloudCompare:

nuage lidar non classé dans cloudcompare

You can see dots above and below the terrain. These points are known as cloud “noise”. As described in the introduction to this article, the generation of a digital surface model involves a process of interpolation. While for some processing, noise is not a problem, as soon as it comes to interpolating values, these points will affect the result quite dramatically. The MNS result for the previous image, without intervening on this noise, gives the following result:

calcul d'un mns sans enlever le bruit du nuage lidar en entrée

The influence of this noise depends on a number of factors (DSM accuracy, interpolation parameters, etc.), but while their influence on the result can be mitigated, the best approach is still to remove the noise before generating the DSM.

In the case of classified data, points considered as noise are included in class 65. A native QGis tool, such as LAStools or WhiteboxTools, can be used to generate the DSM. We’ll look at this in the next chapter.

Here, we’re going to process a raw cloud with noise and use CloudCompare.

Calculating a digital surface model (DSM) with CloudCompare

The advantage of using CloudCompare to perform this processing is that we can visually check the quality of the noise removal.

We start with an unclassified point cloud from the IGN:

nuage de points lidar non classé dans cloudcompare

If we zoom in, we can clearly see the noise present:

zoom sur le bruit du nuage en entrée du mns

Two filters are available in CloudCompare for noise removal:

The SOR filter

The ‘SOR filter’ tool is very similar to the PCL library’s S.O.R. (Statistical Outlier Removal). It first calculates the average distance of each point from its neighbors (considering k nearest neighbors for each – k is the first parameter). Then, it rejects points that are further away than the average distance plus a certain number of times the standard deviation (second parameter). You’ll find it in menu->Tools->Clean->SOR filter

menu edit->clean->sor filter de cloudcompare

This brings up a window where you can enter the two filter parameters:

dialogue du filtre sor de cloudcompare

The Noise filter

The ‘Noise filter’ tool looks a bit like the S.O.R. filter, but takes into account the distance to the underlying surface instead of the distance to neighbors.

This algorithm locally adjusts a plane (around each cloud point) and then removes the point if it is too far from the adjusted plane. This filter can be thought of as a low-pass filter.

To estimate the underlying (flat) surface, the user can define a radius or a (constant) number of neighbors. The user can also choose between a relative error (such as S.O.R.) and an absolute error. Isolated points can also be deleted in the same run.

In our case, using the SOR filter is much more efficient. The result is :

nuage lidar filtré avec le filtre sor de cloudcompare

And if you zoom in, you can confirm that the noise has been eliminated:

zoom sur le nuage sans bruit dans cloudcompare

To create an SNM, click on the cleaned layer in the layer list, then on CloudCompare’s Raster tool.

bouton rasteriser de cloud compare

This brings up the raster transformation configuration window.

paramétrage de la rasterisation pour le mns avec cloudcompare

The step parameter indicates the precision of the output grid. By default, it is 1 meter, but we’re going to make an MNS with a step of 0.5m.

In Active Layer, select Cell height values

The direction parameter must be set to Z for horizontal interpolation and the cell height must be set to maximum.

Click on Update grid and you’ll see a preview of the result.

création du modèle numérique de surface avec raster de cloudcompare

Click on the “Raster” button to create the MNS raster:

menu export du modèle numérique de surface

Give your MNS file a name and you’re done.

We can now load the MNS into QGis and see the result.

We load the original LIDAR point cloud and the raster we’ve just created.

To see exactly how the MNS was calculated, we’ll use View -> Elevation profile

résultat du modèle numérique de surfaces dans qgis->vue profil

You can see that the MNS has been correctly calculated for this point cloud.

If you have a classified point cloud, in CloudCompare you will need to remove (filter) the points that have been classified as noise, before making the MNS raster.

nuage de points classés en, entrée du mns dans qgis

In this example, we have classes 64, 64 and 202, which include noise as well as points of no interest to the DSM.

In CloudCompare, make sure that you have activated Classification in Scalar Fields.

scalar fields->active=classification dans cloudcompare

We apply a filter to the original layer, using the menu Edit -> Scalar fields -> Filter by value

filtrage du bruit dans cloudcompare

You’ll be presented with a window allowing you to set the range of classes to be exported, export being understood here as the creation of a new layer.

sélection des classes à garder pour le mns dans cloudcompare

In our example, the range is 1 to 202, since these are the values of the classes present in the cloud. We change the max value to 20 (the strongest class is 17: bridge deck), and run

We then have a new point cloud on which we no longer have any noise or artifacts, and which can be used as we saw above to create the raster for the MNS.

résultat du filtrage dans cloudcompare

Calculating a digital surface model (DSM) with LAStools

To create the DSM with LAStools, we’re going to use two tools:

  • the first, LASnoise, will enable us to classify the noise points into a particular class (class 7)
  • the second, las2dem, will enable us to generate a raster with the heights of the points, where we will have excluded class 7.

LASnoise

The LASnoise tool settings window is as follows:

filtrage du bruit d'un nuage lidar non classé avec lasnoise

We leave the default values, in particular classify as with the value 7.

Once the command has been executed, we can open the las2dem tool dialog.

LAS2dem

This tool interpolates a point cloud, using the Z of the points. In this example, with an unclassified LIDAR point cloud, we have classified the noise as class 7. We’ll ask LAS2dem to ignore these points.

In the case of a classified point cloud, we’ll use LAS2dem directly on the classified cloud, asking it to ignore class 65.

création du mns avec las2dem de qgis

In the filter(by return,classification,flags) drop-down menu, select drop_class 7. This will cause noise points to be ignored when interpolating the DSM.

In step size/pixel size set the MNS pixel size, then execute the command.

The result can then be loaded into the QGis window. We can then compare the result with the original point cloud and with the MNS calculated with CloudCompare.

By way of comparison, the MNS generated by CloudCompare took less than a minute to calculate…

The result can then be loaded into the QGis window. We can then compare the result with the original point cloud and with the MNS calculated with CloudCompare.

In red you have the MNS calculated by LAS2dem and in blue the one calculated with CloudCompare. The former appears finer, but whether this finesse is worth the computation time required will depend on how it will be used.

Si cet article vous a intéressé et que vous pensez qu'il pourrait bénéficier à d'autres personnes, n'hésitez pas à le partager sur vos réseaux sociaux en utilisant les boutons ci-dessous. Votre partage est apprécié !

Leave a Reply

Your email address will not be published. Required fields are marked *