CM.calculateCenterline: Calculate channel centerline

Description Usage Arguments Details Value Author(s) Examples

View source: R/CM.calculateCenterline.r


Calculate the centerline of the channel polygon in 5 steps:

  1. creating Voronoi polygons of the bank points, convert to paths (line segments with two ends) and remove duplicates

  2. filtering for path segments that lie within the banks

  3. filtering for path segments that are dead ends (have less than 2 connected ends)

  4. sorting of the centerline segments to generate centerline

  5. smooth the centerline


CM.calculateCenterline(cmgo.obj, set = NULL)



the global object of type list containing data and parameters created with CM.ini()


an optional argument for processing a specific data set, if NULL all available data sets are used


CM.calculateCenterline() calculates the centerline of the channel polygon (Fig. 7).

Figure: processing Figure 6: A visualization of the calculation of the centerline a) the channel polygon, b) the Voronoi polygons, c) extraction of the centerline segments, d) smoothing of the centerline path.

The function requires as input the channel polygon (Fig. 6a) which must be stored within the global data object previously generated with CM.generatePolygon(). The algorithm then creates Voronoi polygons around the bank points (Fig. 6b). Voronoi polygons around points denote the areas within which all points are closest to that point. The polygons are disassembled to single line segments. In Fig. 6b you can already notice a centerline evolving from the segments in the middle of the channel polygon. To get only these segments a filtering (Fig. 7) is applied to the Voronoi segments.

Figure: processing Figure 7: the filtering of the Voronoi segments: a) in blue all Voronoi segments, b) in red all segments fully within the channel polygon, c) in green all segments without dead ends.

To retrieve only the segments that represent the centerline all segments that do not lie entirely within the channel banks are removed (Fig. 7b). In a second step dead ends are removed (Fig. 7c). Dead ends are segments that branch from the centerline but are not part of it.

These centerline segments will be chained to one consistent line and get smoothed (Fig. 7d). The degree of smoothing can be adjusted through the parameter centerline.smoothing.width (defaults to the same value as bank.interpolate.max.dist). This centerline represents the reference of the river, for which length, local width and slope are calculated next. Note, that the length of the centerline has decreased by the smoothing in d). It is important to understand, that the length of a river is not a well-defined measure. The length of a river depends on the resolution of the bank points. Similar to the coast line paradox, the length depends on the scale of the observations. Technically, a bended river is a fractal, which means theoretically, the length diverges to infinity at an infinitely high resolution of the bank points. However, practically there is an appropriate choice of a minimum feature size. Every user has to determine this scale individually and should be aware of this choice. The decrease in length due to smoothing is saved as value in the global data object under cmgo.obj$data[[set]]$cl$length.factor. A value of 0.95 means that the length of the smoothed centerline is 95% the length of the original centerline paths.


returns the global data object extended by the centerline data $cl for the respective data set(s)


Antonius Golly


# get demo data
# (find instructions on how to use own data in the documentation of CM.ini())
cmgo.obj = CM.ini("demo")

# generate the polygon from the bank points
cmgo.obj = CM.generatePolygon(cmgo.obj)

# calculate the centerline from the polygon
cmgo.obj = CM.calculateCenterline(cmgo.obj)

# check results
plot.par = CM.plotPlanView(cmgo.obj)

# change degree of smoothing, re-calculate centerline and plot
cmgo.obj$par$centerline.smoothing.width = 12
cmgo.obj = CM.calculateCenterline(cmgo.obj)
plot.par = CM.plotPlanView(cmgo.obj)

AntoniusGolly/cmgo documentation built on April 16, 2021, 2:52 p.m.