Continuous-Time Movement Modeling. Functions for identifying, fitting, and applying continuous-space, continuous-time stochastic movement models to animal tracking data.
I have used this package a couple times, and in both cases I found myself transforming the data from a simple feature (package sf ) to a data.frame so it can be processed by as.telemetry().
So, to avoid this repetition, I made a method to as.telemetry() for sf point objects and I tought it might be useful for other users. See below:
as.telemetry.sf = function(object, timeformat="",timezone="UTC", projection=NULL,timeout=Inf,na.rm="row",mark.rm=FALSE,keep=FALSE,drop=TRUE,...) {
if(st_geometry_type(object,by_geometry=FALSE)!="POINT") {stop("only point features supported at the moment")}
library(sf)
coords <- st_coordinates(object)
object$location.long <- coords[,1]
object$location.lat <- coords[,2]
datum <- st_crs(object)$proj4string
object <- st_drop_geometry(object)
DATA <- as.telemetry(object,datum=datum,timeformat=timeformat,timezone=timezone,projection=projection,timeout=timeout,na.rm=na.rm,mark.rm=mark.rm,keep=keep,drop=drop)
return(DATA)
}
Hi,
I have used this package a couple times, and in both cases I found myself transforming the data from a simple feature (package
sf
) to a data.frame so it can be processed byas.telemetry()
.So, to avoid this repetition, I made a method to
as.telemetry()
for sf point objects and I tought it might be useful for other users. See below:Hope it helps!