Minimal helper to create LINESTRING XYZM for mapdeck::add_trips() using an integer range from a time/index column (e.g. "dispersaltime").
type = "points": group points by
group_col(default "id") ordered by time, build one LINESTRING per group with M = integer(time).type = "linestring": if
id_colpresent, collapse time-sliced features per id and ramp M linearly from t -> next_t along vertices; last slice uses next_t = t + 1. If noid_col, each feature ramps t -> t+1.
Arguments
- sf_obj
sf object (POINTS for type="points"; LINESTRING/MULTILINESTRING for type="linestring")
- time_col
character name of time/index column (integers or numeric)
- z_val
numeric constant Z (default 0)
- cast_multi
logical; cast MULTILINESTRING to LINESTRING (default TRUE)
- type
c("points","linestring")
- group_col
character, group/id column for points (default "id" if present)
- id_col
character, id column for linestring collapse (default "id" if present)