PCI Geomatics Help Center

How can we help you today?

DSM to DTM Conversion

PCI Geomatics -

The purpose of this tutorial is to provide you with an easy to follow step-by-step guide for converting a Digital Surface Model (DSM) to a Digital Terrain Model (DTM).

A Digital Surface Model (DSM) is a variation of a Digital Elevation Model (DEM) that represents the surface of the earth, including vegetation, buildings and other man made features. A Digital Terrain Model (DTM) only includes the elevation of the ‘bare earth’ with vegetation, buildings and other man-made features removed (though roads and bridges are typically retained).

In photogrammetry (for the production of ortho images), and GIS (e.g., for watershed analysis) a DTM is the preferred product. However a DSM does have uses in true-ortho production, and other specific types of analysis. A DEM is a generic term that could refer to either a DSM or DTM.

In PCI software there are two primary tools to convert a DSM to DTM.  These are:

The manual method in Focus allows for very fine control of the conversion process and gives the best results. The automated method via the DSM2DTM algorithm can produce acceptable results under many circumstances but the results usually benefit from touch ups via manual editing in Focus.

The processes described in this tutorial require a previously created DEM file. Please see the DEM Extraction tutorial: support.pcigeomatics.com/hc/en-us/articles/203482839-DEM-extraction

You can download sample imagery for DEM generation from the following link:  https://www.intelligence-airbusds.com/en/23-sample-imagery  

Manual Editing with the DEM Editing Panel in Focus

To access the DEM Editing Panel:

Open the DSM in Focus by selecting Focus > File > Open

In the menu bar select Layer > DEM Editing

The DEM Editing Panel will appear. The DSM is shown in a shaded relief for easier viewing. When making edits, it is suggested that you draw a polygon over a portion of the working area of the DSM. You can use the following order of filters (shown below) to convert that section of the DSM to a DTM. These filters can then be repeated using another drawn polygon until the entire DSM is converted:

  • Terrain filters
  • Bump and Pit filters
  • Median filters
  • Clamp filters
  • Final manual touch-up

Terrain Filters

The first filter typically used is the Terrain Filter. This can be either “Terrain filter (flat)” or “Terrain filter (hilly)” depending on your data type. Terrain filter (flat) is more suited to flat areas such as fields or urban areas, while Terrain filter (hilly) is most suited to mountainous or hilly areas.

The two main parameters within the Terrain Filters are Size and Gradient.

The image above shows an example of the Line Measurement Tool being used to measure the largest building in the DSM. In this case, the building is approximately 113 meters in diameter.

Gradient is measured in degrees, ranging from 0 to 90 - from completely flat to completely vertical.

This is a key parameter, as it defines the cut off range for objects to remain in the DTM. For example, specifying 30 degrees will cause the filter to remove everything from the terrain that exceeds 30 degrees in slope, so long as it is also within the specified size.

When determining the value for the Gradient parameter, it is good to keep in mind that the natural angle of repose (the typical angle that natural ground settles at) is about 25 degrees. This means that dropping the gradient value below 25 degrees may begin to remove natural features such as hills. This is why it is ideal to have a Gradient value set as high as possible, as it reduces the likelihood of removing natural slopes.

For this example the Terrain filter (flat) with a size of 333 pixels (100m at 0.30m resolution) and Gradient of 40 degrees was used.

You can see from the image above that with a steep angle of 40 degrees the gravel deposits from the quarry in the bottom centre of the image have not been removed, but almost all buildings have been removed. Note: buildings intersecting with the edge of the selected area in cyan will not be removed as they are not fully contained in the selection.

After running the initial Terrain Filter, you may run further Terrain Filters to improve the smoothness and remove any remaining buildings. This can dramatically improve your filtering quality, and is highly recommended. In this case, it is suggested that you shrink the filter to a smaller Size and reduce the Gradient by 2 to 7 degrees. It is important to reduce the Size of the filter when also reducing the Gradient because it can help prevent the removal of large, gently sloped features, as they will not fall within the Size threshold. If large, coarse filters are consecutively run, smaller hills often are removed.

To improve the results on this particular dataset, the Terrain filter (flat) was run two more times.

Size: 167 (50 meters) Gradient: 37 degrees – ran twice consecutively.

The results of the three total Terrain filter (flat) passes are shown below. Note: the quarry gravel and cliff faces have still not been removed, as our Gradient parameter has remained high at 37 degrees.

Pit and Bump Filters

Pit and Bump filters smooth the DTM by removing small pits and bumps in the landscape while blending the edges of where buildings used to be. Ideally these filters should be small in size with a low gradient to avoid removing important features. The parameters used in this filter are similar to the parameters of the Terrain filters, with Size representing the largest object to remove and Gradient representing the highest slope of an object to remove.

In this example bump and pit filters were run four times in the following order:

  • Remove bumps (keep linear)       Size: 23 (7m) Gradient: 15
  • Remove pits (hilly) Size: 23 (7m) Gradient: 15
  • Remove bumps (keep linear)       Size: 17 (5m) Gradient: 5
  • Remove pits (hilly)                                            Size: 17 (5m) Gradient: 5

The image below displays the result of the four pit/bump filters.

Note: the ground is much smoother and small imperfections in the road and ground have been filled in or removed.

Median Filters

The Median filter is part of the final smoothing of the DTM. This filter will not further remove any bumps, pits, or buildings, but will smooth the edges of hills and roads. The Median filter is best used as a final step.

There are two types of median filters, the Median filter and the Hybrid median filter. The Hybrid median filter preserves harsh edges in the cases where the normal Median filter may blur them, so the relevancy of one or the other is dependent on the dataset.

For most datasets a filter size between 7 – 11 is suitable. In this example the Median filter was run once with a Size: 11

The image below displays the result of one pass of the Median filter. Before (left) and after (right)

Clamp Filters

The final step in creating a DTM from a DSM is the Clamp filter. This filter stabilizes portions of the elevation model by raising and lowering pixels if they are within a certain threshold. This is excellent for leveling out large flat surfaces, like roads or fields. The suggested values for this filter are a Size of 10 and a Clamp percent of 10.

Results of one pass of the clamp filter at size 10, clamp percentage 10. Before (left) and after (right).

Using both the Median and clamp filter will greatly smooth out the DTM. The images below demonstrate before filtering (left) and after Median and Clamp filtering (right).

Manual Touch-up Edits

There may be leftover buildings that need to be removed, or roads that need to be cleaned up along their edges. These manual edits can be completed within the DEM Editing Tool by drawing polygons around the problematic areas and applying filters.

For example, in this dataset there was one building that was not removed during filtering because it was leaning against a hill and was likely mistaken for a natural feature. This building can be easily removed with the Editing tools that are included in the DEM Editing panel.

The below image highlights the single remaining building in the example dataset:

The below images are the before (left) and after (right) using the Terrain filter (flat) tool with a low gradient to remove the smeared building.


The final filtered imagery can be seen below. The first image is the original DSM. The second image is the final filtered DTM.

Automatically Generating a DTM using the DSM2DTM Algorithm

It is possible to automatically convert a DSM to a DTM using the DSM2DTM algorithm. This algorithm can be accessed through the Focus Algorithm Librarian or by using the EASI or Python interfaces.

Automatically generated DTMs may not be as high quality as a manual approach and it is highly recommended that a copy of the original DSM be created. It may be necessary to run the DSM2DTM algorithm a number of times with different settings to get a level of quality that is acceptable.

The DSM2DTM algorithm allows a sequence of Terrain, Pit, Bump, Median and Clamp filters to be run on the DSM. This mimics the recommended sequence described in the manual editing technique in the steps above.

The example below shows how to access the DSM2DTM Algorithm from the Focus Algorithm Librarian.

  1. Select Focus on the Geomatica Toolbar
  2. Open the Algorithm Librarian
  3. Select Algorithm Library > All Algorithms > DSM2DTM
  4. The DSM2DTM Module Control Panel opens.
    • In the DSM2DTM Module Files tab select the DSM you will be converting to a DTM
    • Select an output file name and location for the DTM
    • Click on the Input Params 1 tab
    • Set the parameters and filters based on the printscreen below. Note that you can set multiple filters in a single run.
  5. Click Run
  6. Once the algorithm has run, verify the results based on your individual dataset. 
  7. You can optionally run DSM2DTM again with additional filters set.

Note: The object size determines the size of the kernel that will be used to search for local minimum. Generally, a dimension is used that is large enough to remove most buildings and surface features. However, some manual editing is usually required to refine the final product.

The final filtered image can be seen below. If required, you can continue to run the DSM2DTM algorithm on the filter output to generate the desired result.

For more information on this algorithm and all of the parameters mentioned above please see the Geomatica Help Documentation.

Restoring Areas of the DTM

In some cases, in an automated DSM to DTM conversion some areas are removed that should have remained. For example, the tops of mountains and hills. This is caused by over filtering the image. In a manual conversion you may notice that an error occurred when it is too late to undo the action. In these cases there is a need to restore the original DSM data in those areas. This can be accomplished using the “Smart GeoFill” tool in Focus.

To do this, the original DSM and the DTM are loaded into the Focus window. The Smart GeoFill tool  is used to copy / paste data from the original DSM to the DTM restoring the removed values.

Please see the Smart GeoFill tutorial for more information- support.pcigeomatics.com/hc/en-us/articles/115005621223-Smart-GeoFill

Once all of the edits are made, the DTM is now ready for use in an orthorectification project: support.pcigeomatics.com/hc/en-us/sections/200826039-Orthorectification


Have more questions? Submit a request


Powered by Zendesk