I am currently tracking animals in national parks and have lat/long and date/time data for individuals and a polygon shapefile for the park boundary. I want to know how many times individuals leave the park boundary each month and at what time of day. In nearly every instance, the individuals return to the park, so I need to account for directionality or count every other intersection.
At the moment, I am converting the raw data into telemetry paths as an ltraj object with the 'adehabitatlt' package. However, I cannot seem to trim the ltraj objects to the polygon, nor does it retain the associated time data for individual segments.
In the below example, I would want to know how many times and when the ibex leave the sps polygon:
library(adehabitatLT)
library(sp)
data(ibex)
##Sample Polygon
x_coord <- c(895000, 898000, 898000, 895000, 895000)
y_coord <- c(2031000, 2031000, 2033000, 2033000, 2031000)
xy <- cbind(x_coord, y_coord)
p = Polygon(xy)
ps = Polygons(list(p),1)
sps = SpatialPolygons(list(ps))