mablab / sftrack

sftrack: Modern classes for tracking and movement data
https://mablab.org/sftrack/
Other
53 stars 2 forks source link

[Use case] Visually cleaning a trajectory #1

Closed comtes closed 2 years ago

comtes commented 5 years ago

Use case: Being able to plot the trajectory of an animal. Then visually select outliers and being able to edit the information linked with these location fixes.

Requirements: spatial coordinates (x,y) as geographic coordinates with projection information a time (t) as POSIXt object, ordered in time A quality information: being able to easily 'tag' fixes that are obviously outliers or result of a malfunction of the collar. A graphic interface to directly click on the fixes to edit the field

Input: sftraj object with a field 'quality'

Output: same sftraj as input, but the quality field updated.

Additional information:

basille commented 5 years ago

Thanks Sebastien for the input! This one is a tough one… as it requires dynamic interaction with the sftraj object. I don't think that can make it into the first releases of the package, but that is something we need to keep in mind to make sure it works with a function which would do exactly this.

Just to be clear, the 'quality' information that you mentioned would be a flag — can be anything else as well, as long as it is visually determined (by mouse clicks).

As a first approach, and given that sftraj will rely on sf, the use of identify could get you there. For instance, if sf_obj is your sf object (and trajectories in sftraj will be), something like this works:

library(sf)
demo(nc, ask = FALSE, echo = FALSE)
sf_obj <- st_geometry(st_centroid(nc))
plot(sf_obj, pch = 3, col = "red", axes = TRUE)
identify(st_coordinates(sf_obj))

or, using ggplot2:

ggplot() + geom_sf(data = sf_obj)
identify(st_coordinates(sf_obj))
birderboone commented 5 years ago

I'm re-opening some of these use-cases so theyre easier to find as people submit new ones.

basille commented 2 years ago

Closing this issue now that sftrack is developed and on CRAN.