Skip to contents

This function calculates and adds a column called 'points_per_cs' to an sf dataframe representing cross-sections (linestrings) based on a provided DEM and a minimum points value per cross section.

Usage

add_points_per_cs(
  cs,
  points_per_cs = NULL,
  min_pts_per_cs = 10,
  dem =
    "/vsicurl/https://prd-tnm.s3.amazonaws.com/StagedProducts/Elevation/13/TIFF/USGS_Seamless_DEM_13.vrt"
)

Arguments

cs

An sf dataframe representing cross-sections (linestrings). With a required cs_lengthm column (length of cross section in meters)

points_per_cs

numeric, number of points per cross section. Default is NULL

min_pts_per_cs

An optional minimum points value per cross section. If not provided,

dem

A SpatRaster object representing the Digital Elevation Model (DEM) or a character string referencing a remote resource. the function calculates it based on the length of cross-sections and the resolution of the DEM.

Value

An updated sf dataframe with the 'points_per_cs' column added.