Geomorphometric analysis (geomorphometry) for mapRaster2 data
Geographic Data Processing Using C++ Language — Example 1
Noboru Ogata (Kyoto University)
We present here the examples of implementation to process terrain data held in the form of Grid DEM. Raster data here are assumed to be held in the mapRaster2 format. You can learn how to process terrain data to derive slope characteristics and so on by inspecting examples below.
The minimum information such as source codes and their simple usage are presented here. The explanations on the principles and applications are given in our lectures and seminars. The file extension of the source codes below is ".txt" so that you can browse them easily. Please rename the extension ".cpp" before you make them executable using your C++ developing environment.
(1) Processing of mapRaster2 data
C++ source code ... mrproc.txt
The above is presented as a template. Please use it to code the process you want to implement. This program make extrapolation along the edges of the raster data before processing to enable spatial operations using 3 x 3 kernels. In this example, Laplacian operation is implemented.
Usage ... Type as follows in the Windows command prompt ("yoshida.mr2" is the example of mapRaster2 files to process).
C:\>mrproc yoshida.mr2
The output will be displayed on the screen. In order to display the output using mapRasetr2, please redirect it into a file as follows.
C:\>mrproc yoshida.mr2 > yoshida_01.mr2
(2) Derivation of slope parameters from a digital elevation model (DEM)
C++ source code ... slope.txt
This program extracts slope parameters such as aspect angle and gradient at all sample points on a digital elevation data stored in mapRaster2 format. This code uses the above (1) as the template and defines the structure "vect3d" for three dimensional vectors and the function "normv()" for calculating the normal vector from a triangle. Slope parameters are calculated using elevation of one targeted sample point and adjacent four points. You can choose aspect angle or gradient either by selecting the switch of '-a' or '-g' in the command line. These methods are implemented in mapRaster2 and presented here for the educational purpose.
Usage ... If you want to calculate aspect angle of the slope, please type as follows in the Windows command prompt.
C:\>slope -a yoshida.mr2 > yoshida_asp.mr2
Usage ... If you want to calculate gradient, please type as follows.
C:\>slope -g yoshida.mr2 > yoshida_grd.mr2
Visualized results are shown here.
(3) Derivation of slope parameters from a DEM based on the method of Zevenbergen and Thorne...New!
C++ source code ... quad.txt
Zevenbergen and Thorne (1987) proposed a procedure to output slope parameters i.e. slope angle, aspect angle, profile curvature and plan curvature through calculating coefficients of the quadratic surface (polynomial) fitted to the nine neighborhood points. You can choose the options by selecting the switch of '-s', '-a', '-pr' or '-pl' in the command line. Please note that the output of the calculation of slope angle and aspect angle is not given in the unit of degree. Because the grid of the processed DEM is assumed to be square, please resample the DEM before you make operation. If you want to calculate plan curvature of the slope, please type as follows in the Windows command prompt.
C:\>quad -pl yoshida.mr2 > yoshida_pl.mr2
Visualized results are shown here.
- L. W. Zevenbergen and C. R. Thorne (1987) ‘Quantitative analysis of land surface topography’, Earth Surface Processes and Landforms, Vol. 12, 47-56.
- P. A. Burrough and R. A. McDonnell (1998) Principles of Geographical Information Systems, Oxford University Press, p. 191.
(4) Extracting ridge and stream lines from a digital elevation model (DEM)
C++ source code for ridge line extraction ... ridge.txt
C++ source code for stream line extraction ... drain.txt
Procedures for extracting ridge and stream lines from terrain data are implemented using the above (1) as the template. These procedures are described in the following textbook. Visualized results are shown here.
- P. A. Burrough (1986) Principles of Geographical Information Systems for Land Resources Assessment, Oxford University Press, p. 54.
(5) Hydrological modeling
The procedure to extract stream lines mentioned above is done only by specifying concave points. In the following examples, surface flow from each cell on the DEM is simulated by determining the drain direction among neighboring eight cells. Then the flow courses are accumulated to map stream lines. Because of the nature of the Grid DEM, which cannot trace stream lines in the real world exactly, simulated stream lines often encounter pits and are disconnected. This method cannot determine the drain direction on the flat topography such as plains either.
C++ source code for hydrological modeling ... stream.txt
The following program is the improved version of the program which can find flow routes even in the flat area.
C++ source code for hydrological modeling [improved version]... stream2.txt
These programs were composed by consulting the following textbook. The visualized result of the latter procedure is shown here.
- P. A. Burrough and R. A. McDonnell (1998) Principles of Geographical Information Systems, Oxford University Press, pp. 193 - 195.