moveVis

CRAN version CRAN downloads Build Status Coverage

Introduction

moveVis provides tools to visualize movement data (e.g. from GPS tracking) and temporal changes of environmental data (e.g. from remote sensing) by creating video animations. It works with move, sp and raster class inputs and turns them into ggplot2 frames that can be further customized. moveVis uses gifski (wraping the gifski cargo crate) and av (binding to FFmpeg) to render frames into animated GIF or video files.

Installation

With version 0.10.0, the package has been rewritten from the ground up with the goal to make it easier to customize the appearance of movement animations. Thus, the logic of the package, its functions and their syntax have changed.

moveVis 0.10.2 (stable) can be installed from CRAN:

install.packages("moveVis")

The development version can be installed from GitHub:

devtools::install_github("16EAGLE/moveVis")

Code written for moveVis version <=0.9.9 will not work with newer versions, but it is quite simple and thus highly recommended to switch to the new syntax due to a variety of advantages. moveVis version <=0.9.9 can still be downloaded here and installed manually:

setwd("your/download/directory")
install.packages("moveVis-0.9.9.tar.gz", repos = NULL)

Function overview

moveVis includes the following functions, sorted by the order they would be applied to create an animation from movement and environmental data:

Preparing movement tracks

Creating frames

Adapting frames

Animating frames (as GIF or video)

Viewing movement tracks

Get started

The following example shows how to make a simple animation using a default base map by first aligning your movement data to a uniform time scale, creating a list of ggplot2 frames and turning these frames into an animated GIF:

library(moveVis)
library(move)
library(magrittr)
data("move_data", package = "moveVis") # move class object
# if your tracks are present as data.frames, see df2move() for conversion

# align move_data to a uniform time scale
m <- align_move(move_data, res = 240, digit = 0, unit = "secs")

# create spatial frames with a OpenStreetMap watercolour map
frames <- frames_spatial(m, path_colours = c("red", "green", "blue"),
                         map_service = "osm", map_type = "watercolor", alpha = 0.5) %>% 
  add_labels(x = "Longitude", y = "Latitude") %>% # add some customizations, such as axis labels
  add_northarrow() %>% 
  add_scalebar() %>% 
  add_timestamps(m, type = "label") %>% 
  add_progress()

frames[[100]] # preview one of the frames, e.g. the 100th frame

# animate frames
animate_frames(frames, out_file = "/full/path/to/moveVis.gif")

Examples

You can find code examples on how to use moveVis here:

Example 1: Creating a simple movement animation

Example 2: Customizing frames

Example 3: Using a mapbox satellite base map

Example 4: Custom base maps from raster data (to be added soon)

Example 5: Interaction graphs (to be added soon)

Example 6: Joining frames side by side (to be added soon)

Example 7: View movement tracks

Code snippets

These commented moveVis code snippets, addressing specific issues or questions, could also be helpful to you:

How to hold the last frame of an animation for a defined time and make it look good by using path_fade (requires moveVis >= 0.10.2)

How to display the full traces of each path using trace_show and trace_colour with frames_spatial() (requires moveVis >= 0.10.2)

How to assign multiple path colours per individual to indicate e.g. behavioral segments (requires moveVis >= 0.10.1)

How to adapt the path legend of frames created with frames_spatial()

How to create a data.frame containing each track coordinate per frame

How to overlay frames with additional transparent rasters changing over time (not yet a optimal solution)

Further resources

Detailed code examples explaining how to use specific functions are provided at the fucntion help pages. User contributions such as code examples or tutorials are very welcome and are linked below as soon as they have been spotted somewhere on the web:

Animating Animal Tracks From Multiple Years Over A Common Year With MoveVis: An Example With Blue Whale Argos Tracks On Movebank by Daniel M. Palacios, Marine Mammal Institute, Oregon State University

Features to be added

Things and features that should be added in future versions of moveVis (feel free to contribute to this list using a pull request):

Next version (0.10.2):

Some day:

The Department of Remote Sensing of the University of Würzburg has developed other R packages that might interest you: * getSpatialData, a package to query, preview and download satellite data, * RStoolbox, a package providing a wide range of tools for every-day remote sensing processing needs, * rsMove, a package providing tools to query and analyze movement data using remote sensing.

For other news on the work at at the Department of Remote Sensing of the University of Würzburg, click here.

Acknowledgements

This initiative is part of the Opt4Environment project and was funded by the German Aerospace Center (DLR) on behalf of the Federal Ministry for Economic Affairs and Energy (BMWi) with the research grant 50 EE 1403.