-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
library(trip)
tr <- ...
## overall extent for trip
r <- raster::raster(spex::buffer_extent(tr, 1), res = 0.1, crs = raster::projection(tr))
## turn into line segments, with timedur on each
lines <- explode(tr)
cells <- tabularaster::cellnumbers(r, lines)
library(dplyr)
## now cells has object_ (the line segment), and cell_ (the pixel index)
## copy on timedur and id and starttime
cells <- cells %>% mutate(starttime = lines$starttime[object_],
timedur = lines$timedur[object_],
id = lines$id[object_])
## we have to distribute the timedur evenly across each cell (it's close enough)
cells <- cells %>% group_by(object_) %>% mutate(timedur = timedur / n()) %>% ungroup()
## we can get the lon/lat from the raster
cells <- cells %>% mutate(lon = raster::xFromCell(r, cell_), lat = raster::yFromCell(r, cell_))Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels