Skip to contents

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_col present, collapse time-sliced features per id and ramp M linearly from t -> next_t along vertices; last slice uses next_t = t + 1. If no id_col, each feature ramps t -> t+1.

Usage

sf_to_xyzm(sf_obj, time_col = "dispersaltime", z_val = 0, cast_multi = TRUE)

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)

Details

Sets geometry m_range attribute required by mapdeck.