Latent positions may be queried using arbitrary date-time values. The only method (for now) is 'linear', but default should be 'geodesic'. In time we include more methods to match the GeoPandas implementation.

track_query(x, y, date = NULL, query, type = "linear")

Arguments

x

longitude

y

latitude

date

date-time in POSIXct (or can be ignore, for relative index-time)

query

required argument, date-time values to return inferred x, y positions for

type

linear, geodesic, rhumb, forward, backward, nearest (also need open/closed intervals)

Value

data frame of 'x,y,date' of inferred positions

Details

If date is not included, time itself is treated as the obvious index on n-locations so simple relative time, and query is expected to match this.

We use group_modify to keep the id groups: trips0 %>% group_by(id) %>% group_modify(~track_query(.x$x, .x$y, query = c(4.5, 6.7)))

Examples

track_query(trips0$x[1:10], trips0$y[1:10], query = c(4.5, 5.5, 6.5))
#> Warning: date is null, so assuming linear relative movement in time
#> # A tibble: 3 × 3
#>       x     y  date
#>   <dbl> <dbl> <dbl>
#> 1  116. -42.0   4.5
#> 2  117. -41.9   5.5
#> 3  117. -41.8   6.5
track_query(trips0$x[1:10], trips0$y[1:10], trips0$date[1:10], query = trips0$date[1:10] + 10)
#> # A tibble: 10 × 3
#>        x     y date               
#>    <dbl> <dbl> <dttm>             
#>  1  115. -42.4 2001-01-01 15:40:00
#>  2  116. -41.4 2001-01-01 18:17:02
#>  3  116. -41.1 2001-01-01 21:03:48
#>  4  117. -42.1 2001-01-01 22:09:51
#>  5  116. -41.9 2001-01-01 23:34:04
#>  6  118. -42.0 2001-01-02 01:25:22
#>  7  117. -41.7 2001-01-02 06:45:50
#>  8  118. -40.9 2001-01-02 10:01:36
#>  9  118. -39.7 2001-01-02 13:50:09
#> 10   NA   NA   2001-01-02 16:24:56
s <- seq(min(trips0$date), max(trips0$date), by = "1 hour")