Build shapes.txt-shaped traces from a pipeline trajectory
Source:R/baseline_free.R
g2g_shapes_from_trips.RdConverts the ping-level trajectory of extracted trips into a table shaped
like the GTFS shapes.txt file: one shape per trip, points in travel
order, with cumulative distance. Unlike planned shapes, these traces record
the geometry actually driven, including detours.
Arguments
- trajectory
A data.table of trajectory GPS records with columns
trip_id,latitude,longitude,date,time_str(as returned in the pipeline's$trajectory). Points are ordered bytimestampwhen it contains completePOSIXctinstants, or bydateandtime_strotherwise.- shape_id_prefix
Character prefix for generated shape ids. Default
"SHP_"(shape ids becomeSHP_<trip_id>).