Samples one downstream-to-upstream Flowline at no more than the requested spacing, assigns route measures and extracts DEM elevations.

flowline_points(
  flowline,
  dem,
  station_distance,
  measure_offset = 0,
  measure_units = c("m", "km")
)

Arguments

flowline

sf object; A flowline object.

dem

terra SpatRaster object; A single-layer DEM in the Flowline CRS.

station_distance

numeric; Maximum distance between Flowline points, in metres. Existing vertices are retained.

measure_offset

numeric; Measure assigned to the downstream endpoint, in `measure_units`. Defaults to zero.

measure_units

character; `"m"` preserves the established R API and current clients. `"km"` produces the legacy ArcPy replacement measure profile.

Value

An `sf` point object with `ID`, `ReachName`, `POINT_X`, `POINT_Y`, `POINT_M` in `measure_units`, `km_to_mouth` in kilometres and sampled `Z`.

Details

This retains the established `fluvgeo` behavior of preserving all existing vertices and densifying only segments longer than `station_distance`. The input CRS is retained. The default metre profile and zero origin preserve existing `ohwm2` behavior. FG Studio's ArcPy- replacement chain requests `measure_units = "km"` explicitly.