Digital terrain analysis

    Digital elevation model (DEM) data are essential to hydrological applications and have been widely used to calculate a variety of useful topographic characteristics, e.g., slope, flow direction, flow accumulation area, stream channel network, topographic index, and others. Except for slope, none of the other topographic characteristics can be calculated until the flow direction at each pixel within a DEM is determined. However, flow direction cannot be accurately calculated until depressions and flat areas within a DEM have been rectified. This is a routine problem in hydrologic modeling, because virtually all DEMs contain flat and sink pixels, both real and artifactual, that if left untreated will prevent accurate simulation of hydrologic flow paths. Although a number of algorithms are available for rectifying flat and sink pixels in DEM data, treatment of flat areas and depressions and calculation of flow direction remain problematic for reasons of complexity and uncertainty. Pan et al. (2012) developed a new algorithm called PDEM (can be downloaded at this link (PDEM) ) that effectively rectifies flat and sink pixels. The approach is to use linear interpolation between low elevation grid cells on the edge of each flat area or depression defined as outlets and higher elevation grid cells on the opposite side defined as inflow pixels. The implementation requires an iterative solution to accommodate the irregular geometry of flat areas or depressions and exceptions that arise. Linear interpolation across flat areas or depressions provides a natural way to scale elevation adjustments based on the vertical scale of the surrounding topography, thereby avoiding the addition or subtraction of arbitrary small numbers that we regard as a disadvantage in some prior techniques. Tests for two virtual terrains and one real terrain show that our algorithm effectively rectifies flat areas and depressions, even in low-relief terrain, and produces realistic patterns of flow accumulation and extracted channel networks.

    A MATLAB-based digital elevation model (DEM) data processing toolbox called MDEM is built upon an improved DEM data processing algorithm, known as the PDEM, for rectifying flat areas and depressions in DEM data and producing realistic patterns of flow accumulation and extracted channel networks. Compared to the original PDEM, the computation efficiency of the MDEM has been improved significantly through adding one fill sink step (i.e., replace elevations of all sink pixels in a depression by the lowest elevation along the boundary of the depression) prior to applying the linear interpolation to treat each depression. The MDEM has a graphical user interface (GUI), and six functions including rectify flat areas and depressions in DEM data using the improved PDEM algorithm, calculation of flow direction, calculation of flow accumulation area, watershed delineation, extraction of channel networks, and calculation of the topographic index. All these functions are essential for computing useful topographic variables for hydrological modeling and applications. The MDEM can be downloaded at this link (MDEM).



  • Pan F., Xi X., and Wang C., A Matlab-based digital elevation model (DEM) data processing toolbox (MDEM). Environmental Modelling & Software, 122, 104566, 2019 (Journal Link and Pre-proof PDF ).

  • Pan F., Stieglitz M., and McKane R., 2012: An algorithm for treating flat areas and depressions in digital elevation models using linear interpolation.Water Resources Research, 48(2), W00L10, doi:10.1029/2011WR010735, 2012. (PDF)

  • Pan F., Peters-Lidard C.D., Sale M.J., and King A.W., A comparison of geographical information systems-based algorithms for computing the TOPMODEL topographic index. Water Resources Research, 40(6), Art. No. W06303, 2004. (PDF)