
Calculate Approximate Keylines from Valley or Ridge Networks
create_keylines.RdGenerates approximate keylines by sampling elevation values along main valley or ridge lines and matching them to the nearest pre-computed contour lines.
Important: These keylines are a computational approximation only and should be treated as an orientation for field work. Keylines must always be verified, refined, and adjusted on-site by an experienced practitioner.
Arguments
- dtm
A
SpatRasterobject (terra). The digital elevation model.- lines
A
sforSpatVectorobject. Either the main valley lines fromextract_main_valleys()or the main ridge lines fromextract_main_ridges().- contours
A
sforSpatVectorobject. Pre-computed contour lines with an elevation column namedlevel, typically fromcalc_geomorph_metrics().- n_keylines
Integer. The desired number of keylines per valley or ridge. Default is 3. Note that the actual number returned may be lower if the input line does not span enough elevation range to support the requested number.
Value
A sf object containing the approximate keylines with the following columns:
- level
Elevation of the keyline in map units (usually metres).
- line_id
Integer ID identifying which valley or ridge the keyline belongs to.
- note
A reminder that these lines are approximations requiring field validation.