Skip to contents

Keep one fix per distance unit of travel. Walking the track from the first fix, retain a fix each time the cumulative along-track distance since the last retained fix crosses the distance threshold. This is the move2 analogue of move::thinDistanceAlongTrack().

Usage

mt_thin_distance(x, distance, remove = FALSE)

Arguments

x

A move2 object.

distance

The along-track distance step, in metres. Accepts a numeric scalar or a units object convertible to metres.

remove

Logical. If TRUE, return only the retained fixes. Default FALSE — the full object is returned with a logical thin_selected column.

Value

A move2 object. With remove = FALSE, the input is returned unchanged except for a new logical column thin_selected. With remove = TRUE, only rows with thin_selected == TRUE are returned. Multi-track input is thinned per individual.

Details

The function uses move2::mt_distance() for the per-segment distance, so geographic (lon/lat) data are thinned against great-circle distance and projected data against planar distance. For a multi-track move2 object thinning is independent per individual.

For tracks with very irregular step lengths, the actual distance between successive retained fixes can exceed distance because the threshold is crossed mid-segment and we do not interpolate — we keep the end-point of the segment that crossed. Use mt_interpolate() first if you need exact-distance spacing.

See also

mt_thin_time() for time-based thinning; move2::mt_interpolate() to first regularise the track in time or along a target line; move2::mt_distance() for the underlying distance.

Examples

# \donttest{
library(move2)
fishers <- mt_read(mt_example())
fishers <- fishers[!sf::st_is_empty(fishers), ]
leroy <- fishers[mt_track_id(fishers) == "M4", ][seq_len(500), ]

out <- mt_thin_distance(leroy, distance = 300)
table(out$thin_selected)
#> 
#> FALSE  TRUE 
#>   432    68 
# }