DSM2DTM

Converts a DSM to DTM


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example

Back to top

Description


DSM2DTM converts a raster digital surface model (DSM or elevation) into a bare-Earth digital terrain model (DTM). Filters are used to remove surface items such as buildings and trees. Typically the DSM2DTM process is run on a DSM which was automatically created from image stereo pairs, for example, by the AUTODEM process.
Back to top

Parameters


Name Type Caption Length Value range
FILI * String Input DSM file name 1 - 192  
DBIC * Integer Input DSM channel 1 - 1  
FILO String Output DTM file 0 - 192  
FTYPE String Output file type 0 - 4  
FOPTIONS String Output file options 0 - 64  
DBOC * Integer Output DTM layer 1 - 1  
FAILVALU Float Elevation failure value 0 - 1  
BACKELEV Float Background elevation value 0 - 1  
OBJUNIT * String Object removal dimension units 1 - 8 Geocoded | Pixel
Default: Geocoded
OBJSIZE Float Object size 0 - 48 1 -
GTHRESH Float Gradient angle giving slope of natural features. 0 - 48 0 - 90
TERTYPE String Type of terrain that is being filtered. 0 - 192 Default: HILLY
BUMPFLT Integer Filter size and gradient for bump filters 0 -    
PITFLT Integer Filter size and gradient for pit filters 0 -    
MEDFLT Integer Median filter size 0 - 1  
CLAMPFLT Integer Clamp filter size 0 - 2  

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the file that contains the DSM to convert to a DTM.

DBIC

Specifies the input channel from the input file that contains the DSM.

FILO

Optionally specifies the name of the output file to receive the DTM.

if FILO is not specified then it is assumed to be the same file as specified in FILI.

If FILO already exists it must have the same dimensions and projection as the input file FILI.

If FILO does not exist it will be created with the same dimensions and projection as the input file FILI.

FTYPE

Specifies the output file format type, represented by a three- or four-letter code. The format type must be a GDB-supported file type.

Supported file formats include:

The default value is PIX.

A full list of GDB-recognized file types and their codes is provided in the GDB file formats section of the CATALYST Professional Online Help.

This parameter is ignored when writing to an existing file.

FOPTIONS

Specifies the file creation options that are to be applied when creating the output file. These are specific to the file format; in each case, the default of no options is allowed (empty string). This parameter may be used to specify the compression schemes, file format subtypes, and other information.

Different options are available for different file types (see the FTYPE parameter). The options are described in the GDB file formats section of the CATALYST Professional online Help.

This parameter is ignored when writing to an existing file.

DBOC

The output channel, in file FILO, to write the DTM to. If FILO does not exist and is created then this must be one.

FAILVALU

Optionally specifies the failure value within the input elevation channel.

The failure value identifies pixels in the DSM that should be handled in a special manner; these pixels will be ignored during processing but will be interpolated over at the end.

BACKELEV

Optionally specifies the background elevation (NoData) value in the input elevation channel. This value identifies pixels where there is no actual elevation value in the input DSM. These pixels will be copied to the output DTM but otherwise ignored during processing. The output DTM layer will have the NO_DATA_VALUE meta data tag set to this value.

If this parameter is not specified, the function checks for ELEVATION_BACKGROUND or NO_DATA_VALUE metadata tags, first at the channel level, then at the file level.

If this value is not specified or found in the metadata, the function uses the default value of -32768.

OBJUNIT

Specifies the units to use for the OBJSIZE parameter.

Available options are:

OBJSIZE

The size of the filter to use to remove surface features. It is best to use a size relevant to the largest feature's largest diameter, such as the largest building to remove. Typically, to remove most buildings and small stands of trees, an object size ranging from 150 to 200 meters provides suitable results. For example, if you wanted to remove a rectangular building with a footprint of 100m x 150m, the value of the maximum diameter of 180 should be used for the filter size.

You may need to experiment to obtain the result you want. For example, a very-high value can remove desired natural features, such as small hills. The value you use can vary from DSM to DSM: the value that provides suitable results in one may not in another.

The units for the tile size are defined by the OBJUNIT parameter.

GTHRESH

The gradient in degrees that determines the flatness threshold.

Pixels with slopes below the defined threshold are treated as natural slopes and are not removed. This is useful for preserving hills and natural slopes. The higher the gradient threshold, the less likely you are to remove buildings with edges that are not well-defined; that is, those that do not have not sharp, crisp edges. The lower the value, the more likely you are the remove natural features of the terrain.

In aerial-derived DSMs of flat urban areas, a value of 25 degress can be appropriate, which will tend to remove buildings. In mixed flat and hilly areas with buildings values of 30 or 40 may be better, because this better preserves natural features and still does a reasonable job of removing buildings. Rural areas in rugged terrain may work best with values over 50, though in such a case it may be necessary to touch up the final DTM manually, because low buildings will not fall within the steep 50 degree threshold.

It is possbile to run multiple terrain filters of the same type with varying sizes. DSM2DTM will read in the pairs of numbers defined by OBJSIZE and GTHRESH, executing them one after the other, then continuing on to apply any other specified filters such as bump or pit filters. For example, setting OBJSIZE =150,100 and GTHRESH =40,30 will first execute a size 150 filter with a 40 degree threshold, and then execute a size 100 filter with a 30 degree threshold.

TERTYPE

Specifies the type of terrain which allows processing to make better decisions about what internal parameters to use. Available options are:

BUMPFLT

Optionally specifies how many bump filters to use in cleaning up small bumps left over after removing buildings and other large features.

Each bump filter is specified as a pair of numbers, the size of the square filter in pixels and the gradient in degrees (slope). Often small values are used such as 7,5 (7 pixels and a gradient of 5°). Using two pairs the same size can be useful (e.g., 7,5,7,5). Typically, you will run bump filters and pit filters after the terrain-type filter; however, you can run them before the terrain filter by adding a minus sign (-) to the value; for example, -7,-5. Doing so can be effective in smoothing hills so they are not misinterpreted as buildings.

The units for the tile size are defined by the OBJUNIT parameter.

PITFLT

Optionally specifies how many pit filters to use in cleaning up pits and holes left over after removing buildings and other large features.

Each pit filter is specified as a pair of numbers, the size of the square filter in pixels and the gradient in degrees (slope). Often small values are used such as 7,5 (7 pixels and a gradient of 5°). Using two pairs the same size can be useful (e.g., 7,5,7,5). Typically, you will run pit filters and bump filters after the terrain-type filter; however, you can run them before the terrain filter by adding a minus sign (-) to the value; for example, -7,-5. Doing so can be effective in smoothing hills so they are not misinterpreted as buildings.

The units for the tile size are defined by the OBJUNIT parameter.

MEDFLT

Optionally specifies the size of the hybrid median filter to apply at the end of processing. The hybrid median filter smooths the final DTM while preserving sharp slopes. The Median Filter has two modes: hybrid and normal. Hybrid is used when the value is a positive number, or you can use normal mode by using a minus sign (-) before the value. With hybrid mode, smoothing of the final DTM is more pronounced in preserving sharp slopes while normal mode is less so.

You can use a value of 3 or greater; however, a larger filter may significantly increase processing time, particularly on high-resolution data. Typically, a value ranging from 7 through 11 provides suitable results.

CLAMPFLT

Optionally specifies a pair of numbers, size and percentage, that define a 'clamp' filter to apply at the end of processing. Values can range between 3 and 50 for the size and 1% to 300% for the percentage.

A clamp filter is a special variation of the average filter in which a pixel cannot be altered in elevation by more than a percentage of the resolution of pixel. For example, if the DSM resolution is 2m then a clamp filter of 15,10 would mean that an average filter of size 15x15 should be applied but no pixel can be changed by more than 2m*0.1 = 0.2m (or 20cm). A clamp filter can be useful making features like roads very smooth without the danger of blurring sharp slopes.

Back to top

Details

A digital surface model (DSM), often created automatically from overlapping images using AUTODEM, can have elevation values that reflect the top of canopy or top of buildings. For many processes such as orthorectification it is necessary to have a digital terrain model (DTM)that reflects the height of the bare Earth.

DSM2DTM automatically converts a DSM into a bare-Earth DTM by applying a series of filtering steps that remove features such as buildings and tree stands and can smooth the result by removing small bumps and pits and s final smoothing step such as a median filter. The user can control this process by providing the size and of the filters and the gradients (or slopes) that give hints about the features in the DSM. Finding the right settings can require running the DSM2DTM process a number of times and examining the final results. Occasionally manual touches, using the DEM editing tool in Focus, may be required to remove very large buildings.

The input file FILI contains the DSM and the generated DTM can be output to separate file specified by FILI, or written into channel in FILI if FILO is not specified. It is possible to overwrite the original DSM with the DTM (if DBIC equals DBOC and FILO is not specified), however it is strongly recommended that a copy of the input file be created ahead of time if this option is used.

In some cases a DSM will have areas where elevation values have failed to be generated and need to be interpolated from surrounding elevation values. The FAILVALU parameter can be used to specify the special value these pixels have. However most DSM already have this interpolation applied so this is only used in special cases.

Most DSMs also contain pixels with a background value identifying where no elevation information is available. This is also refered to as a 'no data' value. The BACKELEV parameter is used to specify what this value is. If BACKELEV is unspecified then the meta data tags ELEVATION_BACKGROUND or NO_DATA_VALUE are automatically checked for in the file and used if found. If these are not found a value of -32768 is used internally.

The DSM2DTM filtering process first applies removal of large surface features (controlled by the OBJUNITS, OBJSIZE and GTHRESH parameters), then removes smaller bumps and pits (controlled by the BUMPFLT and PITFLT parameters) and then applies final smoothing filters (controlled by the MEDFLT and CLAMPFLT parameters). Bump and pit filters are applied one after the other, in an alternating pattern. Note that the bump, pit and smoothing filters are always expressed in size of pixels regardless of what the OBJUNITS parameter is set to. The TERTYPE parameter provides hints to the processing by defining the type of terrain. The best settings depend on the DSM and it may be necessary to try different settings to get the best results. The DSM2DTM process is quite fast so generating four or five different versions and comparing them is normal.

Back to top

Example

A DSM, at 50cm resolution, of the city of Hamilton, Ontario, was generated from 220 aerial images. This DSM needs to be converted to a DTM before it can be used in creating an ortho mosiac. The largest buildings in the city are about 100m in size. A few are much larger but since the Hamilton area contain main hills and a large sloping escarpement using a very large filter size could remove many natural features. The few very large remaining buildings can be removed manually afterwards.

        EASI>fili        =   "hamilton_dsm.pix"
        EASI>dbic        =   1
        EASI>filo        =   "Hamilton_dtm.pix"  ! doesn't exist so is created
        EASI>ftype       =   "PIX"
        EASI>foptions    =   "TILED512"
        EASI>dboc        =   1
        EASI>failvalu    =	                    ! no failed pixels
        EASI>backelev    =	                    ! use meta data or -32768
        EASI>objunit	    =   "GEOCODED"
        EASI>objsize     =   100                 ! 100m maximum object size
        EASI>gthresh     =   35                  ! Hills are not too steep
        EASI>tertype     =   "HILLY"             ! DSM has flat areas and hills
        EASI>bumpflt     =   7,5,7,5             ! remove small bumps twice
        EASI>pitflt      =   7,5                 ! fill in small pits once
        EASI>medflt      =   9                   ! gentle final smoothing
        EASI>clampflt    =                       ! no clamp filtering

        EASI>RUN DSM2DTM
      

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.