[R-sig-Geo] dynamic (interactive) representation of several GPS trajectories
Roman Luštrik
roman.lustrik at gmail.com
Fri Feb 20 11:56:54 CET 2015
Hello Gabriele,
have you considered "slicing" your data according to time, put everything
in a RasterStack or RasterBrick and visualize it using some other package,
like `animate`? I think this example (
http://vis.supstat.com/2012/11/brownian-motion-with-r/) is close to what
you're after. What is the desired format you're shooting for? A gif? Or
does it have to be embedded in html?
Cheers,
Roman
On Fri, Feb 20, 2015 at 11:43 AM, Gabriele Cozzi <gab.cozzi at gmail.com>
wrote:
> Dear list,
>
> I have relocation data for about 20 individuals (ID) for a total of about
> 70K rows organised in the following data frame:
> timevar <-as.numeric(Timestamp); SB is categorical with 2 levels, the other
> variables are self-explanatory I think
>
> ID Date Time Timestamp Lon Lat
> Alti SB timevar
> D 2013-01-01 18:40:00 2013-01-01 18:40:00 21.85803 -26.99953 917 0 1500
> D 2013-01-01 18:55:00 2013-01-01 18:55:00 21.85877 -27.00000 921 0 2400
> D 2013-01-01 19:10:00 2013-01-01 19:10:00 21.85907 -27.00015 925 0 3300
> A 2013-01-01 19:27:00 2013-01-01 19:27:00 21.85875 -27.00142 922 1 4320
> A 2013-01-02 06:40:00 2013-01-02 06:40:00 21.85872 -27.00142 919 1 44700
> A 2013-01-02 06:55:00 2013-01-02 06:55:00 21.86060 -27.00090 916 0 45600
> .. ............... ........... ......................
> ........ ......... .... .. ......
>
> What I would like to do is to create an animated plot where I can see how
> the various individuals move in relationship to each other.
>
> The gvisMotionChart() function from the googleVis package does what I need
> on a small subset of my data but it crashes if I try to do the same on the
> entire data set.
>
> A reproducible example for two individuals:
> x <- rnorm(40, 21, 0.5)
> y <- rnorm(40, -27, 0.5)
> ID <- rep(c("A","B"), each=20)
> Alt <- floor(rnorm(40, 900, 10))
> tvar <- 1:40
> tvarA <- sample(tvar,20)
> tvarB <- setdiff(tvar, tvarA)
>
> DF <- data.frame(ID,x,y,Alt,tvar = c(tvarA,tvarB))
> DF <- DF[order(DF$ID,DF$tvar),]
>
> library(googleVis)
> plot(gvisMotionChart(DF, idvar="ID", timevar= "tvar"))
>
>
> An alternative along the lines of what I want would be the
> trajdyn{adehabitatLT}, even if it does not allow dynamic movements of more
> than one individual at the time, which is unfortunate in my case.
>
> Any suggestion regarding alternative packages/functions is highly
> appreciated.
>
> Thanks in advance,
> Gabriele
>
>
> --
> Gabriele Cozzi
> Postdoctoral Research Associate
> Population Ecology Research Group
> http://www.popecol.org
>
> Zurich University
> Institute of Evolutionary Biology and Environmental Studies
> Winterthurerstr. 190
> 8057 Zurich - Switzerland
> E-mail: gabriele.cozzi at uzh.ch
> Office: 34-J-38
> Phone: +41(0)44 635 47 56
> Fax: +41(0)16355711
> http://www.ieu.uzh.ch
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
In God we trust, all others bring data.
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list