Skip to contents

Method for calculating the weight of an edge between two nodes from the value of the input raster at each of those nodes (x1 and x2), designed for a single DEM input. The method assumes an input raster in which:

  • NA indicates a road cannot be built

  • Negative values are costs for crossing streams or other barriers that are crossable but expensive. Edges that link to barrier penalty (negative value) nodes are assigned the largest barrier penalty weight.

  • Zero values are assumed to be existing roads.

  • All other values are interpreted as elevation in the units of the raster map (so that a difference between two cells equal to the map resolution can be interpreted as 100% grade) This is a simplified version of the grade penalty approach taken by Anderson and Nelson: The approach does not distinguish between adverse and favourable grades. Default construction cost values are from the BC interior appraisal manual. The approach ignores (unknown) grade penalties beside roads and barriers in order to avoid increased memory and computational burden associated with multiple input rasters.

Usage

slopePenaltyFn(
  x1,
  x2,
  resolution = 1,
  baseCost = 16178,
  limit = 20,
  penalty = 504,
  limitWeight = NA
)

Arguments

x1, x2

Value of the input raster at two nodes. A difference of 1 implies a 100% slope.

resolution

Resolution of the input raster. Resolution and x1/x2 should have the same units.

baseCost

Construction cost of 0% grade road.

limit

Maximum grade (%) on which roads can be built.

penalty

Cost increase associated with each additional % increase in road grade.

limitWeight

Value assigned to edges that exceed the grade limit. Try setting to a high (not NA) value if encountering problems with disconnected graphs.

Examples

slopePenaltyFn(0.5,0.51)
#> [1] 16682
slopePenaltyFn(0.5,0.65)
#> [1] 23738
# grade > 20% so NA
slopePenaltyFn(0.5,0.75)
#> [1] NA