Code Monkey home page Code Monkey logo

16eagle / movevis Goto Github PK

View Code? Open in Web Editor NEW
130.0 15.0 20.0 32.05 MB

An R package providing 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.

Home Page: http://www.movevis.org

License: GNU General Public License v3.0

R 100.00%
animation visualization animal-movement movement-ecology animal-behavior remote-sensing animal-tracking movement-video r animal-environment

movevis's Introduction

moveVis

CRAN version CRAN downloads CRAN checks R-CMD-check Coverage Package dependencies

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 and raster class inputs and turns them into ggplot2 frames that can be further customized. moveVis uses gifski (wrapping the gifski cargo crate) and av (binding to FFmpeg) to render frames into animated GIF or video files.

A peer-reviewed open-access paper accompanying moveVis has been published in Methods in Ecology and Evolution.


Figure 1: Example movement tracks nearby Lake of Constance on top of a OSM watercolor and a mapbox satellite base map



Figure 2: Example movement tracks nearby Lake of Constance and a gradient base layer faded over time

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.

The latest stable version of moveVis 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)

Get started

The following example shows how to make a simple animation using a default basemap by first aligning your movement data to a uniform time scale, creating frames that can be viewed or modified using ggplot2 or add*() functions and turning these frames into an animated GIF:

library(moveVis)
library(move)

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 = 4, unit = "mins")

# create spatial frames with a OpenStreetMap watercolour map
frames <- frames_spatial(m, path_colours = c("red", "green", "blue"),
                         map_service = "osm_stamen", 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(type = "label") %>% 
  add_progress()

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

# animate frames
animate_frames(frames, out_file = "moveVis.gif")

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

  • df2move() converts a data.frame into a move or moveStack object. This is useful if you do not usually work with the move classes and your tracks are present as data.frames.
  • align_move() aligns single and multi-individual movement data to a uniform time scale with a uniform temporal resolution needed for creating an animation from it. Use this function to prepare your movement data for animation depending on the temporal resolution that suits your data.
  • subset_move() subsets a move or moveStack by a given time span. This is useful if you want to create a movement animation of only a temporal subset of your data, e.g. a particular day.

Creating frames

  • get_maptypes() returns a character vector of available map types that can be used with frames_spatial(). moveVis supports OpenStreetMap and Mapbox basemap imagery. Alternatively, you can provide custom imagery to frames_spatial().
  • frames_spatial() creates moveVis frames spatio-temporally displaying movement. Frames can be individually plotted using ggplot2, modified individually or as a whole using add*() functions, or animated using animate_frames().
  • frames_graph() creates moveVis frames displaying movement-environment interaction graphs. Frames can be individually plotted using ggplot2, modified individually or as a whole using add*() functions, or animated using animate_frames().

Adapting frames

  • add_gg() adds ggplot2 functions (e.g. to add layers such as points, polygons, lines, or to change scales etc.) to the animation frames created with frames_spatial() or frames_graph(). Instead of creating your own ggplot2 functions, you can use one of the other moveVis `add_``functions:
  • add_labels() adds character labels such as title or axis labels to animation frames created with frames_spatial() or frames_graph().
  • add_scalebar() adds a scalebar to the animation frames created with frames_spatial() or frames_graph().
  • add_northarrow() adds a north arrow to the animation frames created with frames_spatial() or frames_graph().
  • add_progress() adds a progress bar to animation frames created with frames_spatial() or frames_graph().
  • add_timestamps() adds timestamps to animation frames created with frames_spatial() or frames_graph().
  • add_text() adds static or dynamically changing text to the animation frames created with frames_spatial() or frames_graph().
  • add_colourscale() adjusts the colour scales of the animation frames created with frames_spatial() and custom map imagery using the r_list argument.
  • join_frames() side-by-side joins two or more moveVis frame sequences of equal lengths into a single plot per frame using cowplot::plot_grid. This is useful if you want to side-by-side combine spatial frames returned by frames_spatial() with graph frames returned by frames_graph().
  • get_frametimes() extracts the timestamps associated with each frame from a moveVis object created using frames_spatial() or frames_graph() and returns them as a vector.

Animating frames (as GIF or video)

  • suggest_formats() returns a selection of suggested file formats that can be used with out_file of animate_frames() on your system.
  • animate_frames() creates an animation from moveVis frames computed with frames_spatial(), frames_graph() or join_frames().

Viewing movement tracks

  • render_frame() renders an individual frame. It yields the same result as if an individual frame is extracted using default subsetting [[.
  • view_spatial() displays movement tracks on an interactive mapview or leaflet map.

Methods

  • [ extracts individual frames or a sequence of frames from a moveVis frames object.
  • [[ renders an individual frame.
  • c combines multiple moveVis frames objects.
  • tail() and head() return n last or first frames of a moveVis frames object.
  • length() return length of moveVis frames, i.e. number of frames.
  • print() shows basic information about a moveVis frames object, i.e. number of frames, extent and more.
  • rev() reverses the order of a moveVis frames object.

Processing settings

  • use_multicore() enables multi-core usage for computational expensive processing steps.
  • use_disk() enables the usage of disk space for creating frames, which can prevent memory overload when creating frames for very large animations.

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: View movement tracks

Real-data example using White Storks (Ciconia ciconia) migration movement data [.docx]

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

How to display the full traces of each path using trace_show and trace_colour with frames_spatial()

How to colour paths based on a continuous variable

How to assign multiple path colours per individual, e.g. to indicate behavioral segments

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 (hacky, not a very optimal solution)

Further resources

Detailed code examples explaining how to use specific functions are provided at the function 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

Reproducible example of how to combine animal tracking data, tidal water height data and a heightmap to visualize animal movement with moveVis by Henk-Jan van der Kolk, The Netherlands Institute of Ecology (NIOO-KNAW)

How to build animated tracking maps using tracking data in Movebank and environmental covariates in track and raster annotations from EnvDATA with moveVis by Sarah C. Davidson, Data Curator at Movebank

Mentions

Blog post: Featured article in Issue 11.5: Our May issue is now online! by Methods in Ecology and Evolution

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):

  • follow population mode
  • follow individual mode
  • 3D animations, e.g. for including altitude data

Related packages

Other R packages that might interest you:

  • basemaps, a package to download and cache spatial basemaps from open sources such as OpenStreetMap, Stamen, Thunderforest, Carto, Mapbox and others,
  • 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.

Acknowledgements

This initiative was part of the Opt4Environment project and had been 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.

Citation

An open-access paper accompanying the moveVis R package has been peer-reviewed by and published in 'Methods in Ecology and Evolution' (see https://doi.org/10.1111/2041-210X.13374). Please cite moveVis, e.g. when you use it in publications or presentations, using the output of citation("moveVis") or as follows:

Schwalb-Willmann, J.; Remelgado, R.; Safi, K.; Wegmann, M. (2020). moveVis: Animating movement trajectories in synchronicity with static or temporally dynamic environmental data in R. Methods Ecol Evol. 2020; 11: 664–669. https://doi.org/10.1111/2041-210X.13374

movevis's People

Contributors

16eagle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

movevis's Issues

Error with animate_move... due to wrong subsetting?

Hi there,

I've successfully created an animation using the example and sample data that you provide, but when I try to do it with my own data I'm getting this error:

Error in prog_x_st[1:prog_bar_length] :
only 0's may be mixed with negative subscripts

I'm not sure if this is the reason, but I found that this error may occur when "you get a vector with a mix of positive and negative values, which isn't allowed in subsetting." (https://stackoverflow.com/questions/9221310/r-debugging-only-0s-may-be-mixed-with-negative-subscripts?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa)

Would you have any idea on why this may be happening? I am attaching a sample of my data as an example. Thanks!

These are all the messages I get when I run the function:
Checking prerequisites...
Detected 'conv_dir' executable on this system: 'convert'
Paths interpolation will be applied, since 'frames_tres' is user-defined.
Computing uniform frame times from timestamps...
Assigning base layers per frame ticks...
Building map elements...
Error in prog_x_st[1:prog_bar_length] :
only 0's may be mixed with negative subscripts

sample_track.zip

Problem with base-map

Hi,
I am testing moveVis package to visualize GTFS (public transport) data. I have a problem with base map. I have created data.frame called GTFS and then I used this file to create move class object. Finally I executed a following code to get video output file:
animate_move(GTFS_ani, out_dir, out_name = "test5", conv_dir = conv_dir, paths_mode = "true_data", frames_nmax = 10, img_caption = img_caption, img_title = img_title, log_level = 1, out_format = "mp4", map_type = "roadmap", paths_col = line_colors)

I've got following response:

Checking prerequisites...
Warning: Detected minimum temporal resolution of 42 seconds, but non-uniform timestamps, paths interpolation will be forced.
Warning: 'frames_tres' set to 42 seconds, since undefined.
Warning: Linear paths interpolation can massively distort movement, particularly non-movement periods!
Computing uniform frame times from timestamps...
Assigning base layers per frame ticks...
Error in download.file(gurl, filename, mode = "wb", quiet = TRUE) :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=40.3871530746987,-3.66474108396037&zoom=9&size=494x500&maptype=satellite&format=gif&sensor=false&scale=1'
In addition: Warning message:
In download.file(gurl, filename, mode = "wb", quiet = TRUE) :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=40.3871530746987,-3.66474108396037&zoom=9&size=494x500&maptype=satellite&format=gif&sensor=false&scale=1': HTTP status was '403 Forbidden'
Error in download.file(gurl, filename, mode = "wb", quiet = TRUE) :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=40.3871530746987,-3.66474108396037&zoom=9&size=494x500&maptype=satellite&format=gif&sensor=false&scale=1'
In addition: Warning message:
In download.file(gurl, filename, mode = "wb", quiet = TRUE) :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=40.3871530746987,-3.66474108396037&zoom=9&size=494x500&maptype=satellite&format=gif&sensor=false&scale=1': HTTP status was '403 Forbidden'
Error in download.file(gurl, filename, mode = "wb", quiet = TRUE) :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=40.3871530746987,-3.66474108396037&zoom=9&size=494x500&maptype=satellite&format=gif&sensor=false&scale=1'
In addition: Warning message:
In download.file(gurl, filename, mode = "wb", quiet = TRUE) :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=40.3871530746987,-3.66474108396037&zoom=9&size=494x500&maptype=satellite&format=gif&sensor=false&scale=1': HTTP status was '403 Forbidden'
Error in download.file(gurl, filename, mode = "wb", quiet = TRUE) :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=40.3871530746987,-3.66474108396037&zoom=9&size=494x500&maptype=satellite&format=gif&sensor=false&scale=1'
In addition: Warning message:
In download.file(gurl, filename, mode = "wb", quiet = TRUE) :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=40.3871530746987,-3.66474108396037&zoom=9&size=494x500&maptype=satellite&format=gif&sensor=false&scale=1': HTTP status was '403 Forbidden'
Error: Download from Google failed. Please check your internet connection.

Any idea, how to solve this issue?

Also: the above change my working directory:
before it used to be:
getwd()

"F:/Documentos/MSCA_CAlCULUS/TRAINING/MovieR"

While after the (unsuccessful) execution of animate_move I get this:
getwd()

[1] "C:/Users/Marcin/AppData/Local/Temp/RtmpCGQzFJ/moveVis"

The same effect regardless internet connection nor system (I've tried on Windows 10 and macOS HighSierra (10.13.6).

I apprreciate any help,
Marcin

Error: Download from Google failed. Please check your internet connection.

Hiya,

I am just trying out the MoveVis package to animate some fish movement data I have collected. I have entered this code and get the following error:

move_bass<-move(x=df_bassmov$deploy_long,y=df_bassmov$deploy_lat,
time = as.POSIXct(df_bassmov$Date.Time, tz="UTC"),
data = df_bassmov, proj =CRS("+proj=longlat +ellps=WGS84"),
sensor=df_bassmov$Receiver,
animal=df_bassmov$animal_id)

conv_dir <- get_libraries()
out_dir<-"C:/Users/Tstamp/OneDrive - University of Plymouth/PhD/2. Chapter Projects/1. Vemco Tagging/Results/Animation"
img_title<-"Bass movement moveVIS"
img_caption <- "Projection: Geographical, WGS84; Sources: Google Maps"

animate_move(move_bass,out_dir,conv_dir,tail_elements = 10,
paths_mode = "true_data", frames_nmax = 50,
img_caption = img_caption, img_title = img_title,
log_level = 1, layer = "basemap",frames_tres=180,
out_format = "mov")

response from console:

Checking prerequisites...
Paths interpolation will be applied, since 'frames_tres' is user-defined.
Computing uniform frame times from timestamps...
Assigning base layers per frame ticks...
Error in if (extLL) { : missing value where TRUE/FALSE needed
Error in if (extLL) { : missing value where TRUE/FALSE needed
Error in if (extLL) { : missing value where TRUE/FALSE needed
Error in if (extLL) { : missing value where TRUE/FALSE needed
Error: Download from Google failed. Please check your internet connection.#

Could you please advise?

Changing "frames_tres" causes R to hang and zero output

Hello Jakob,
Thanks for creating this fantastic package and the accompanying guidance.

I have generated several successful .mov outputs using my own data, but when I define "frames_tres = 60" [i.e. asking for a 60 second .mov output] this causes R to "hang" and no output is ever generated and the run does not seem to complete. Could this be a computer performance issue during the paths interpolation process or am I missing something obvious?

Here is the code (which works fine when frames_tres is not specified, but takes several hours to complete). The dataset consists of 12,133 observations, requiring generation of 6,292 frames:

animate_move(data_ani, out_dir, conv_dir = conv_dir, tail_elements = 10,
paths_mode = "true_data", frames_nmax = 0, frames_fps = 100,
img_caption = img_caption, img_title = img_title,
img_sub = img_sub, log_level = 1, scalebar_dist = 1000, frames_tres = 60, out_format = "mov", out_name = "Rupis20172018")

Result:##

Checking prerequisites...
Detected 'conv_dir' executable on this system: 'ffmpeg'
Paths interpolation will be applied, since 'frames_tres' is user-defined.
Computing uniform frame times from timestamps...

end

Thank you in advance,
Louis

font size and movie speed

Thanks for your help with resolving the video export issues. I have two more questions regarding animate_move:

  1. is there a way to increase the font size of the time_scale?

  2. is there a way to control the speed at which the output movie plays? I have been tweaking the frames parameters but haven't found a way to effectively slow the movie down

Thanks so much for your ongoing assistance. This is a fun program!

get_imconvert() bug on windows machines with preinstalled ImageMagick [fixed on GitHub]

In the moveVis CRAN version 0.9.4, get_imconvert() fails to identify preinstalled ImageMagick installations that do not contain convert.exe. In those cases, get_imconvert() assumes convert.exe to be in the main folder of the ImageMagick installation. In those cases either reinstall an ImageMagick version containing convert.exe or download the portable version to a directory of your choice and provide the convert.exe path manually to the "convert" arguments of animate_move etc.

This bug is fixed in the recent GitHub commits. In case that a preinstalled ImageMagick version without convert.exe is found, get_imconvert() now continues as it would if no ImageMagick installation exists. This issue will be closed as soon as the bug fix included wihtin the current GitHub version is on CRAN.

Error in idData not trackID

When I try to run this line of code, I get this error

p <- move(pdfhvtrack$lon, pdfhvtrack$lat, proj=CRS("+proj=longlat +ellps=WGS84"),

  •       time = pdfhvtrack$dt, animal=pdfhvtrack$individual, data=pdfhvtrack)
    

Error in validityMethod(as(object, superClass)) :
Order of objects in the idData is not the same as in the trackId
In addition: Warning messages:
1: Unknown or uninitialised column: 'citation'.
2: Setting row names on a tibble is deprecated.

head(pdfhvtrack)

A tibble: 6 x 5

lon   lat population individual dt                 


1 41.4 -91.0 Pool 16 T12414 2018-07-31 00:00:00
2 41.4 -91.0 Pool 16 T12414 2018-09-25 00:00:00
3 41.5 -90.6 Pool 16 T12414 2018-11-09 00:00:00
4 41.5 -90.6 Pool 16 T12415 2018-06-12 00:00:00
5 41.5 -90.6 Pool 16 T12415 2018-06-28 00:00:00
6 41.5 -90.6 Pool 16 T12415 2018-09-18 00:00:00

str(pdfhvtrack)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 255 obs. of 5 variables:
$ lon : num 41.4 41.4 41.5 41.5 41.5 ...
$ lat : num -91 -91 -90.6 -90.6 -90.6 ...
$ population: Factor w/ 4 levels "Pool 14","Pool 16",..: 2 2 2 2 2 2 2 2 2 2 ...
$ individual: Factor w/ 102 levels "T12414","T12415",..: 1 1 1 2 2 2 2 3 3 4 ...
$ dt : POSIXct, format: "2018-07-31" "2018-09-25" "2018-11-09" "2018-06-12" ...

NA timestamps

After running the lines of code below, I keep getting an "Error in validity: There are NA timestamps records". The layout of my data is exactly the same as to move_data. I'm not sure what the error could be?

for(i in 1:length(indi_subset)){

  • if(i == 1){
  • data_ani <- list(move(x=indi_subset[[i]]$lon,y=indi_subset[[i]]$lat,
    
  •                       time=indi_subset[[i]]$dt,
    
  •                       proj=CRS("+proj=longlat +ellps=WGS84"),
    
  •                       animal=indi_levels[i]))
    
  • }else{
  • data_ani[i] <- list(move(x=indi_subset[[i]]$lon,y=indi_subset[[i]]$lat,
    
  •                          time=indi_subset[[i]]$dt,
    
  •                          proj=CRS("+proj=longlat +ellps=WGS84"),
    
  •                          animal=indi_levels[i]))}
    
  • }
    Error in validityMethod(as(object, superClass)) :
    There are NA timestamps records

Output directory issue

For some reason the animate_move function cannot create an output directory. This warning ends up killing the creation of the GIF.

Warning message:
In file.create(to[okay]) :
cannot create file '/out/test/final_gif.gif', reason 'No such file or directory'

Thanks

Robby

error when attempting initial time stamps function

move_sci<-cont_clean_dt

use df2move to convert the data.frame into a moveStack

df2move(move_sci,
proj = "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0",
x = "Longitude", y = "Latitude", time = "datetime", track_id = "TrackID")

unique(timestamps(move_sci))
timeLag(move_sci, unit = "mins")

#Error in (function (classes, fdef, mtable) : unable to find an inherited method for function #‘timestamps’ for signature ‘"tbl_df"’

load error

Hello, I'm getting an error on loading the package. Install is always successful, then error on loading is something to do with 'sf' and object group_map (from 'dplyr', I think). I am using R version 3.5.2. I tried uninstalling / reinstalling the package, also uninstalling / reinstalling / updating 'sf' and 'dplyr' with no change in the error message.

Install and load messages below:

install.packages("moveVis")
Installing package into ‘C:/Users/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/moveVis_0.10.2.zip'
Content type 'application/zip' length 3039027 bytes (2.9 MB)
downloaded 2.9 MB
package ‘moveVis’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\AppData\Local\Temp\Rtmpgzv1d3\downloaded_packages

library("moveVis")
Error: package or namespace load failed for ‘moveVis’:
.onLoad failed in loadNamespace() for 'sf', details:
call: get(genname, envir = envir)
error: object 'group_map' not found
In addition: Warning message:
package ‘moveVis’ was built under R version 3.5.3

When I try to call df2move() it says it cannot find the function.

Maybe this is an issue on my end, but I haven't found any help online and am stuck. Thanks for any help you can give me!

Error when using fade_raster argument

The script below returns an error which disappears if I use fade_raster=F.

frames <- frames_spatial(move_data1[1:50], r_list= MAP[1:2] , r_times=times[1:2] ,fade_raster=T, equidistant=F,ext=extent(MAP[[1]]),alpha=1,map_res=1,

  •                      tail_length = 25, tail_size = 1, path_size = 3, path_end = "round", path_join = "round", path_mitre = 10,
    
  •                      path_arrow = NULL, path_colours = "red", path_legend = F)
    

Processing movement data...
|==================================================| 100% elapsed = 00s
Assigning raster maps to frames...
Error in stats::as.formula(form) :
argument "form" is missing, with no default

Any idea where the problem could come from?

Thanks!

Error - incorrect number of layer names

I am having issues running the movevis example data. I've run this example code previously before the latest update and it worked fine, but no longer.

Heres the code I am running:

data("move_data")

move_data$dt <- as.POSIXct(strptime(move_data$dt, "%Y-%m-%d %H:%M:%S", tz = "UTC"))

data_ani <- split(move(move_data$lon, move_data$lat, proj=CRS("+proj=longlat +ellps=WGS84"),
time = move_data$dt, animal=move_data$individual, data=move_data))

#Specify output directory
out_dir <- paste0(getwd(),"")

#Specify some optional appearance variables
img_title <- "Movement of the white stork population at Lake Constance, Germany"
img_sub <- paste0("including individuals ")
img_caption <- "Projection: Geographical, WGS84; Sources: Movebank 2013; Google Maps"

animate_move(data_ani,
out_dir,
conv_dir = conv_dir,
tail_elements = 10,
paths_mode = "true_data",
frames_nmax = 50,
img_caption = img_caption,
img_title = img_title,
img_sub = img_sub,
log_level = 1,
out_format = "gif")

And I get this error:

Error in names<-(*tmp*, value = c("red", "green", "blue")) :
incorrect number of layer names

Any help would be greatly appreciated!
Thanks,
Matt.

Last step

So I first went through this with my own data and couldn't get the last step to work, so I used your data and ran into the same issue. Everything works until the last step of code (last step being when you call on animate_move) and I get this error
Error in animate_move(data_ani, out_dir, conv_dir = conv_dir, tail_elements = 10, :
object 'img_sub' not found

Thoughts?
Thanks in advance
SS

Issue with automatic detection of libraries on Windows

Hi Jakob, thanks to you and your colleagues for this exciting program. I was able to run the Example "#Call animate_move() with an automatic basemap.." and out_format = gif

However, I am having issues with the example "#use another output format, e.g. "mov"". I downloaded FFmpeg to my computer (apparently) successfully, following the steps found here: https://www.wikihow.com/Install-FFmpeg-on-Windows

I am getting the following error in moveVis (below), and would greatly appreciate any assistance you could provide. Thank you very much.

conv_dir <- "C:\ffmpeg\bin\ffmpeg.exe"

#Call animate_move() with "static_data" added #use another output format, e.g. "mov"
#moveVis Ex. 2
animate_move(m, out_dir, conv_dir, tail_elements = 10, paths_mode = "true_data", frames_nmax = 50,

  • img_caption = img_caption, img_title = img_title, img_sub = img_sub, log_level = 1, extent_factor = 0.0002,
  • static_data=static_data, out_format = "mov")

Checking prerequisites...
Detected 'conv_dir' executable on this system: 'C:\ffmpeg\bin\ffmpeg.exe'
Error: 'C:\ffmpeg\bin\ffmpeg.exe' not recognized. 'tool' must either be 'convert', 'ffmpeg' or 'avconv'.
In addition: Warning messages:
1: running command 'C:\Windows\system32\cmd.exe /c C:\ffmpeg\bin\ffmpeg.exe' had status 1
2: In cmd.fun(conv_dir, ignore.stdout = TRUE, ignore.stderr = TRUE) :
'C:\ffmpeg\bin\ffmpeg.exe' execution failed with error code 1

Extend overlap not recognized

Hello,

This is probably an issue on my end, and I apologize for posting it here, but I wasn't sure how to resolve it otherwise. When I run animate_move, I keep getting the error "Error in .local(x, y, ...) : extents do not overlap." I assume this refers to the move object and the base layer. However, the extent of the move object is fully within the extent of the base layer, and they are both in the same projection, and they do overlap when plotted together (or rather when I plot the location points used to inform the move object over the raster that I'm using for a base layer, as the move object does not plot over the raster).

The base layer is a single raster without any temporal element; I'm wondering if this could be causing the problem?

The animate_move function and extent & CRS information on the move object and base layer are as follows:

animate_move(data_ani1, out_dir = ".", conv_dir = "convert", out_format = "gif", paths_mode="simple", layer=finland, layer_type="discrete")
Checking prerequisites...
Warning: Detected minimum temporal resolution of 7078 seconds, but non-uniform timestamps, paths interpolation will be forced.
Warning: 'frames_tres' set to 7078 seconds, since undefined.
Warning: Linear paths interpolation can massively distort movement, particularly non-movement periods!
Computing uniform frame times from timestamps...
Assigning base layers per frame ticks...
Error in .local(x, y, ...) : extents do not overlap

extent(finland) #base layer, .tif raster object
class : Extent
xmin : 20000
xmax : 739750
ymin : 6597200
ymax : 7836750

extent(data_ani1) # move object; code below
class : Extent
xmin : 205828.2
xmax : 620020.2
ymin : 6677971
ymax : 7080056

crs(finland) #base layer, .tif raster object
CRS arguments:
+init=epsg:3067 +proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0
+units=m +no_defs

crs(data_ani1) # move object; code below
CRS arguments:
+init=epsg:3067 +proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0
+units=m +no_defs

For your reference, the code for the move object is as follows:

data_ani1<- move(df6$X, df6$Y, proj=TM35FIN, time = df6$Date_time_new, animal=df6$NAME, data=df6)

Thanks so much!

Error in creating vis with raster layer

Hi,
I am trying to create a vis with data for a single individual downloaded from movebank. I am able to create a gif with google basemap as layer. However, when I use and NDVI raster, I get the following error.

Duration of output animation file: 00:00:08 (hh:mm:ss) [173 frames, 25 fps]
Drawing frames...
|==================================================================================| 100% elapsed = 03m 19s
Total run time: 5.12 minutes
Error: animate_move failed due to unknown error.
In addition: Warning messages:
1: running command 'C:\WINDOWS\system32\cmd.exe /c D:/Programs/imagick/convert.exe' had status 1
2: In cmd.fun(conv_dir, ignore.stdout = TRUE, ignore.stderr = TRUE) :
'D:/Programs/imagick/convert.exe' execution failed with error code 1

Error in rep(x[3], diff(x[1:2]) + 1) : invalid 'times' argument

Hi there,

I thought that issue was fixed by one of the previous updates but I still get the same error when using frames_spatial.
This is the code I use:
frames <- frames_spatial(move_data1[1:1500], r_list= MAP, r_times=times ,fade_raster=F, equidistant=F,ext=extent(MAP[[1]]),alpha=1,map_res=1,
tail_length = 25, tail_size = 1, path_size = 3, path_end = "round", path_join = "round", path_mitre = 10,
path_arrow = NULL, path_colours = "red", path_legend = F)

where MAP is a list of 54 rasters and times a list of 54 times as POSIXct. The data is attached.
If I used MAP[1:6] and times[1:6] it works but as soon as I have a times from a slot >6 I get the error. Using MAP[1:7] and times[c(1:6,6)] does work as well...
Any idea where the problem might be coming from?

I also noticed that using MAP[1:7] and times [1:6] (ie r_list and r_times are NOT the same length) works fine without a warning.

Thanks!
movevis_error.RData.zip

shiny app

How about turning this into a shiny app?

Misspelled package

Hi.

In example 2:

library(moveVis)
library(move)
library(raster)
library(ggplo2) is mis-spelled

data("move_data")

install error...

Hi, I'd like to try this but I'm having install issues...initially I tried to install, got a warning, and then when I tried to load the library it kept crashing my RStudio session. Didn't copy the warning initally after install unfortunately.

Now getting this error when trying to install:

ERROR: failed to lock directory ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library’ for modifying
Try removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/00LOCK-moveVis’
Error in i.p(...) : 
  (converted from warning) installation of package ‘/var/folders/jv/56h34hjn2l302ypnnsphwnx00000gn/T//Rtmp5P5yCd/fileb1f2567a767/moveVis_0.10.0.tar.gz’ had non-zero exit status

My session info:

R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.3

Error in .pointsToMatrix(p1) : longitude > 360 after projecting data

Hi there,

I am trying to work with my own dataset and I have issue with move_align() after projecting my data using spTransform. My initial data in LatLong format and I would like to plot it in UTM. Here is the code I used:
move_data <- df2move(d1, x="long",y="lat", proj="+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0", time = "Local", track_id="name")
move_data <- sp::spTransform(move_data, crs("+proj=utm +zone=33 +south +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 "))
move_data1 <- align_move(move_data, res = 60, digit = "mean", unit = "mins")
Which result in the following error:
Error in .pointsToMatrix(p1) : longitude > 360

If I used the already projected data
move_data <- df2move(d1, x="x",y="y", proj="+proj=utm +zone=33 +south +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 ", time = "Local", track_id="name")
move_data1 <- align_move(move_data, res = 60, digit = "mean", unit = "mins")
It results in the same error...
I did check and all the long, lat, x and y columns are numeric not factors.

What am I getting wrong?
Attached is a sample of my data.

Thanks in advance for the help!
Stephanie
test_file.txt

Error: Output file could not be found.

Hi, I am trying to use the below code to create a gif of my data downloaded/formatted from movebank.

#Get libraries
conv_dir <- "C:/Program Files/ImageMagick-7.0.8-Q16/convert.exe"

#Find out, which output file formats can be used
get_formats()

#Specify output directory
out_dir <- paste0(getwd())

#Specify some optional appearance variables
img_title <- "Movement of the eastern wild turkey in Maine, USA"
img_caption <- "Projection: Geographical, WGS84; Sources: Movebank 2013; Google Maps"

####For a the 2018 greenfield birds, Winter to Nest movement 2018###
animate_move(turkeygps, out_dir, out_name = "Greenfield Birds Animation Winter to Nest1", conv_dir = conv_dir, tail_elements = 10,
paths_mode = "true_data", frames_nmax = 530,
img_caption = img_caption, img_title = img_title,
log_level = 1, out_format = "gif")

When I set the frames_nmax = 50, the code runs fine and creates a gif. When I set frames_nmax = 0 or 530 (around the total number of frames) to generate a gif of the entire movement, I get the following output. (Edit: I did some additional tweaking and I get this code above around 200)

Checking prerequisites...
Warning: Detected minimum temporal resolution of 3434 seconds, but non-uniform timestamps, paths interpolation will be forced.
Warning: 'frames_tres' set to 3434 seconds, since undefined.
Warning: Linear paths interpolation can massively distort movement, particularly non-movement periods!
Computing uniform frame times from timestamps...
Assigning base layers per frame ticks...
Copyright © 2019 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.
Zoom: 11
Fetching 6 missing tiles
|========================================| 100%
...complete!
Building map elements...
Duration of output animation file: 00:00:21 (hh:mm:ss) [520 frames, 25 fps]
Drawing frames...
|==================================================| 100% elapsed = 31m 36sError: Output file could not be found.
In addition: Warning message:
In cmd.fun("batch.bat >nul 2>1") :
'batch.bat >nul 2>1' execution failed with error code 1

I'm having a bit of trouble interpreting the errors/warnings to diagnose what I am doing incorrectly or if this is something outside of my code.

Thanks

Error in rep(x[3], diff(x[1:2]) + 1) : invalid 'times' argument

Hey Jakob - I'm having an issue with the frames_spatial() step. I can make a move object using df2move() and then regularize the location data with align_move(), but when I try to run frames_spatial() I get the error above. It's weird though because the movement data processes fine (as per the progress bar, which hits 100% after 8 seconds). A few seconds after "Assigning raster maps to frames..." prints, the error pops up. My r_times argument is in POSIXct format and is the same length as r_list.

This error only appears when my own raster data are included. If I use frames_spatial() with location data only, the function works and I can proceed with animate_frames().

Problem downloading portable ImageMagik

I'm new to moveViz and am wanting to visualise movements of a number of fish species in the marine environment. To get a handle on the code, I ran the code provided but have run across an error that I can't understand.

Everything works up until:

conv_dir <- get_imconvert()
[1] "Downloading portable ImageMagick..."
trying URL 'ftp://ftp.imagemagick.org/pub/ImageMagick/binaries/ImageMagick-7.0.6-0-portable-Q16-x64.zip'
downloaded 4096 bytes

Warning message:
In unzip(paste0(dir, "/imagick.zip"), exdir = paste0(dir, "/imagick")) :
error 1 in extracting from zip file

Any thoughts?

error in example

move_data$dt <- as.POSIXct(strptime(move_data$dt, "%Y-%m-%d %H:%M:%S", tz = "UTC"))

gives this:

Error: '%' is an unrecognized escape in character string starting ""%"

move_data$dt <- as.POSIXct(strptime(move_data$dt, "%Y-%m-%d %H:%M:%S", tz = "UTC"))

does not

Code works for a subset of my dataset but gives error for another

Hi there,

I am using moveVis to visualize my data. My code works well for a subset of my dataset but gives error for another subset...

Any ideas about what could be going wrong?

Thanks,
Danai

animate_move(dtanimwt, out_dir, conv_dir,

  •          paths_mode = "true_data",
    
  •          img_title = img_title, frames_nres = 10,
    
  •          overwrite = TRUE)
    

Checking prerequisites...
Detected 'conv_dir' executable on this system: 'convert'
Warning: Detected minimum temporal resolution of 0.999000072479248 seconds, but non-uniform timestamps, paths interpolation will be forced.
Warning: 'frames_tres' set to 0.999000072479248 seconds, since undefined.
Warning: Linear paths interpolation can massively distort movement, particularly non-movement periods!
Computing uniform frame times from timestamps...
Error in seq.int(0, to0 - from, by) : wrong sign in 'by' argument
In addition: Warning messages:
1: In FUN(X[[i]], ...) : no non-missing arguments to min; returning Inf
2: In FUN(X[[i]], ...) : no non-missing arguments to min; returning Inf
3: In FUN(X[[i]], ...) : no non-missing arguments to min; returning Inf
4: In FUN(X[[i]], ...) : no non-missing arguments to min; returning Inf

NA values in coordinates & Memory Exhausted errors

Hi,

Thanks for the cool package, I'm excited to see animations of my data when I can figure out a couple issues. I've attached a small subset of my data, and the code that I used.

Code:
library(moveVis)
library(move)

setwd("/users/ljh2001/Documents")

move_data<- read.csv("move_data.csv")

move_data$dt <- as.POSIXct(strptime(move_data$dt,
"%m/%d/%Y %H:%M:%S", tz = "UTC"))

move_data$individual<- as.factor(move_data$individual)

str(move_data)

m <- move( y = move_data$lon, x = move_data$lat, proj= CRS("+proj=longlat +init=epsg:6112"),
time = move_data$dt, data = move_data)

conv_dir <- get_libraries()

out_dir <- paste0(getwd(), "/Animations")
indi_names <- unique(move_data$individual)

img_title <- "Arctic Char"
img_sub <- paste0("including individuals",indi_names)
img_caption <- "Projection: Geographical, WGS84; Sources: Movebank 2013; Google Maps"

animate_move(m, out_dir, conv_dir = conv_dir, tail_elements = 10, paths_mode = "true_data", frames_nmax = 50, img_caption = img_caption, img_title = img_title, img_sub = img_sub, log_level = 1, out_format = "mov")

Issue 1: Everything seems to be working until I attempt the animate_move function. The function begins to run, but eventually I get an error (Error in .local(obj, ...) : NA values in coordinates). This message caused me to look back at my data multiple times to check for potential typos, but I didn't find any. As far as I can tell, my data is set up the same as the example data (which does work). I did use a csv file in my code, but couldn't attach one here. Running get_libraries() gives me [1] "convert" "ffmpeg" , so I'm guessing the external libraries downloaded fine.

Issue 2: As I mentioned above, this is only a small sample of a much larger dataset (~250000 acoustic detections). When I try to run a larger set say (~3000 detections or the entire thing) I get a memory exhausted error. I also get a warning about non-uniform timestamps (I get that warning when the above code runs too). Could this just be related to Issue 1, or is it too computationally intense to create animations for that many detections with non-uniform timestamps?

Thanks for the help, and for creating such a cool package. I hope we can get it to work for me! Please let me know if I can provide other helpful information.

move_data.xlsx

myscript

dataframe to df2move

What are the columns and structure that I need for my data to convert with df2move? Right now I have lat, long (both numeric), trackId (factor) and dt (POSIXct). I am having a very hard time get my animation to work on the new update. Here is the code that I have so far.

library(moveVis)
library(move)
library(magrittr)
library(lubridate)

pdfhrecenttracks$trackId<-as.character(as.factor(pdfhrecenttracks$trackId))
pdfhrecenttracks$dt <- ymd_hms(pdfhrecenttracks$dt)

m.move <- df2move(pdfhrecenttracks, proj = "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0", x = "x", y = "y", time = "dt", track_id = "trackId")
m <- align_move(m.move, res = 1800, unit = "secs")

n <- 121
color = grDevices::colors()[grep('gr(a|e)y', grDevices::colors(), invert = T)]
unique.colors <- sample(color, n)
pie(rep(1,n), col=unique.colors)

frames <- frames_spatial(m, path_colours = unique.colors,
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()

animate_frames(frames, out_file = "C:/Users/dombbom56/Documents/test/new.mp4")

RGB output map option orders stack layers wrongly

plt.bm <- paste0('ggRGB(ld[[10]][[x]],r=3,g=2,b=1,stretch="',layer_stretch,'") + scale_fill_identity() + scale_y_continuous(expand = c(0,0)) + scale_x_continuous(expand = c(0,0)) + theme(aspect.ratio=1)')

The layer ordering argument in ggRGB() is set to the wrong defaults (r=3,g=2,b=1) it should be:
r=1,g=2,b=3.

Issue converting data.frame to moveStack object

move_37_sample.xlsx

Hello,

I'm running into the error below when I run the following code. I'm a fairly new R users, so I'm not sure how to troubleshoot this error. As far as I can tell, my data file is setup similarly to the example data (attached as an .xlsx file). Help appreciated!

move_df <- methods::as(move_37_sample, "data.frame")

move_df$dt <- as.POSIXct(strptime(move_df$dt,"%m/%d/%Y %H:%M:%S", tz = "UTC"))
move_df$id<- as.factor(move_df$id)

df2move(move_df,
proj = "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0",
x = "lon", y = "lat", time = "dt", track_id = "id")

Error in df[, track_id] == x :
comparison of these types is not implemented
In addition: Warning message:
In which(df[, track_id] == x) :
Incompatible methods ("Ops.data.frame", "Ops.factor") for "=="

remove trackId

How do I remove trackId labels from my map in moveVis?

Processing times for large data frame and multiple individuals

I have a large data frame (>100,000 positions and 10-20 individuals) that I am currently running through animate_move(). It has been processing for close to 30 hours, and the outputs:

[1] "[LOG]: Creating PNG frame files (this may take a while; depending on the spatial resolution of the basemap)..."
[1] "[LOG]: Creating GIF file..."

have repeated 8 times so far. Just wondering if this is usual for a data frame of this size, or the repetitions signify multiple unsuccessful attempts at compiling the GIF final file?

Thanks!

installation error

Hi,

I have this problem when installing the package

screen shot 2019-02-23 at 11 36 54 pm

It seems that slippymath API names just changed.

Thanks,
Gabriel

Error using mapbox

Hi,

I get this error while using mapbox layers:

Error in .local(.Object, ...) :

Error in .rasterObjectFromFile(x, objecttype = "RasterBrick", ...) :
Cannot create a RasterLayer object from this file.

Error with geolocator data

Moin,

Thanks for the outstading package.

Sadly I have a problem to animate a movie with my geolocation data.
I used the attached dataset.
The animation of the movie works, when I set the "frames_nmax" - value in the animate_move-function up to 146, but at 147 and higher the function gives the error:

Fetching 6 missing tiles
|=====================================================================================================================| 100%
...complete!
Error in rgb(bm.df$red, bm.df$green, bm.df$blue, maxColorValue = if (any(maxValue(bm.down) > :
Farbintensität -0.00120972 nicht in [0, 1]

But as the dataset has over 600 points it is useless for me to see only the first 146 points in the movie.
With another dataset this strange threshold is at "frames_nmax= 134"

Maybe someone has an idea about it?

thanks a lot,
Thiemo

BF871_LTD.txt

Plot error when using basemap of type "discrete" [fixed on GitHub]

In CRAN version 0.9.4, sometimes a plot error occurs when using basemaps of type "discrete". This bug has been fixed in the recent GitHub commits. Please update via GitHub in case of troubles with discrete basemaps, e. g. LC classifications. This issue will be closed as soon as the bug fix is on CRAN with the next CRAN version.

Error in prog_x_st[1:prog_bar_length]

Hello again,
Not sure if the previous issue is solved (I still get info: "cannot open URL", but only once and the script seems to proceed further). But, I get another one:

Building map elements...
Error in prog_x_st[1:prog_bar_length] :
only 0's may be mixed with negative subscripts

It confused me as I used to work with the same file and it worked... Attached please find the csv file and the code I use is this:

GTFS <- read.csv("GTFS_M5.csv")
GTFS$arrival_time <- as.POSIXct(strptime(GTFS$arrival_time, "%H:%M:%S", tz = "UTC"))
conv_dir <- get_libraries()

out_dir <- paste0(getwd(),"/test")

GTFS_ani <- split(move(GTFS$stop_lon, GTFS$stop_lat, proj=CRS("+proj=longlat +ellps=WGS84"),
                       time = GTFS$arrival_time, animal=GTFS$trip_id, data=GTFS))

animate_move(GTFS_ani, out_dir, out_name = "test5", conv_dir = conv_dir, 
             paths_mode = "true_data", frames_nmax = 10,
             log_level = 1, out_format = "mp4",
             map_type = "roadmap")

GTFS_M5.zip

I saw a similar topic on closed issues, however, I'm not sure whether it was solved (I am using the newest version from CRAN: 0.9.8).

an error regarding prog_x_st

Hello,

I absolutely love your work! However, I have been having some issues regarding creating and saving the gif and I was curious if you can give some insight.

Right, so...I tested out the package on a small section of the data set. Interestingly enough, it only displayed a portion of the data (although it did run successfully). Right, so I isolated the ones that didn't run and tried them on their own, however, unfortunately, it didn't work. Likewise, I tried another random sample and I got the same error message at the end which is the following: Error in prog_x_st[2:prog_bar_length] :
only 0's may be mixed with negative subscripts

The reason why I am confused is that it worked fine the first time and the data is formatted in the same exact way, nor did the animals move considerably. The only difference are the dates and (very minimally, of course) the coordinates (but not by more than a few kms).

Do you know why it may have worked for one 'test run' but not the other?

Thank you.

add_timestamps error - timestamps length different from frames length

Hi Jakob,

Great package and improvements! I have a quick question.

I am creating an animation that looks at multiple individuals that have different start and stop times.

When I run the add_timestamps() function I get the error "Error: Unique timestamps of 'm' must be of same length as 'frames'. Do only use the same move or moveStack object that you have used to create 'frames'."

Yet I have given the add_timestamps() function my move object created by align_move() (called 's.align') which I use to create frames.

The problem is:

length(frames)
[1] 10702
length(unique(s.align@timestamps))
[1] 10703

I have tried this with a different species, also with multiple individuals, and get the same error.
I am not sure how to troubleshoot this because I cannot look into what data is in the frames and thus which timestamp is not being plotted. Any ideas on what might be wrong here?

Thanks!

Theresa

Adding scalebar: Error in .pointsToMatrix(p1) : longitude < -360

Hello,
I am having some issues when trying to add the scale bar to the frame. If I don't add any scale bar, then everything works fine and I get the frames and video. This is the error I get:
Error in .pointsToMatrix(p1) : longitude < -360

My study area is small, so the scale bar should be lower than 1 km, so I am guessing it has to do with that. Is there any way to work around it.
This is my code. Thanks for your help.

GPS<-df2move(GPS, proj = "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0",
x = "Longitude" , y = "Latitude", time = "dt", track_id = "ID")

unique(timestamps(GPS))
timeLag(GPS, unit = "mins")

move_data <- align_move(GPS, res = 240, digit = 0, unit = "secs")

move_data <- sp::spTransform(move_data, crs("+init=epsg:3857"))
frames <- frames_spatial(move_data, path_colours = c("red"),
map_service = "osm",path_legend_title = NULL, map_type = "streets", map_res = 0.8, equidistant = F)

frames <- add_labels(frames, title = " (UK) 2019",
x = "Longitude", y = "Latitude") %>%
add_progress() %>%
add_scalebar() %>%
add_northarrow() %>%
add_timestamps(move_data, type = "label")

is it possible to skip gaps?

Hello @schwalbwillmann! I have been playing with you moveVis package and I think is great! Excellent job!
But I remember the previous version had an option to "skip gaps" in time. It never really worked for me, so I wonder if this newest version may be able to do it?
My track are movement data on nesting birds, so I have cleaned the data and only have the moving "points". That definitely defies the idea of "uniform" time scale, but I wonder if there is way around it when aligning (I supposed that is the right moment to do it). I guess I could also make several animations per individual trip but if having several birds (as of now I have worked only with one individual in a 3 day period) the times at the nest will differ for sure.
Anyway, jut wanted to bug you with this maybe you have some ideas, or just sad news saying movisVis wont be able to do it! hehehe
Thanks either way!
Francis

New df2move error on trackid

Hi,

I love your map animation and worked several hours getting it to go. But it was worth the try.
I wanted to use some personal data that i need to run on the maps. while converting my data frame using df2move i get this error. I tried to factor the lodi which is my track id, but that didnt work either. Can you tell me where/what i am missing out?

Thanks

Error enclosed------------------------------------------------------------------------

Error: Must use a vector in [, not an object of class matrix.
Call rlang::last_error() to see a backtrace

Error Ends-----------------------------------------------------------------------
library(moveVis)
library(move)

df <- read_excel("c:/users/hp/desktop/bird/testdata.xlsx")

#df$loco_id <- as.factor(df$loco_id)

df <- df[!duplicated(df),]

y <- df2move(df,
proj = "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0",
x = "lon", y = "lat", time = "time", track_id = "lodi")

testdata.xlsx

Error in .pointsToMatrix(p1) : latitude > 90 In addition: Warning message: In .pointsToMatrix(p1) : longitude > 180

Hi all,
I'm also working with my own dataset (in LongLat format) and I'm getting an error message when trying to align my movement data with align_move(). My code is as following:

R.move<-move(as.numeric(R.ready$Longitude.decimal),as.numeric(R.ready$Latitude.decimal),
time = R.ready$Timestamp.1,
proj="+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0")
unique(timestamps(R.move))
timeLag(R.move,unit="mins")
m<-align_move(R.move, res = 1200, unit = "mins")

When I run this i get the following Error message:

Error in .pointsToMatrix(p1) : latitude > 90
In addition: Warning message:
In .pointsToMatrix(p1) : longitude > 180

Cannot figure out what is wrong here. Hope you can help me. See the data attached.
Many thanks in advance!
Matteo
Move_sample.txt

another timestamp issue

Hi,
I am having the same issue where I can get the code for some individuals to work, while others don't, and the code is the same. Below are the head and tail of my dataset. There are no NAs. Let me know if you need more info... I was also wondering how I could add fixed "landmarks" (in my case, nest locations) on the map as you did in the white stork example with camera locations.

my error message is:
"Error in validityMethod(as(object, superClass)) :
The dataset includes timestamps that are not ascending"

screen shot 2018-09-17 at 4 42 25 pm

screen shot 2018-09-17 at 4 42 37 pm

And here is the code.
sevenJD$Date<- as.POSIXct(strptime(sevenJD$Date, "%m/%d/%Y"))

data_ani2 <- move(sevenJD$Longitude, sevenJD$Latitude, proj=CRS("+proj=longlat +ellps=WGS84"),
time = sevenJD$Date, animal=sevenJD$ID, data=sevenJD)

Any help is much appreciated!
-Sarah

installation error

Hi,

I get this error when i try to install movevis from github

Installing packages into ‘C:/Users/Anjan ROGue/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Error: (converted from warning) dependencies ‘stats’, ‘utils’, ‘grid’, ‘grDevices’, ‘graphics’, ‘methods’, ‘splines’ are not available

Issues with timestamps

Hi Jakob. I am back. I am having the following error message but it only occurs when i working on the movement certain individual not others. I have tried ordering the timestamps but still not working. Can you please advice me on what might be wrong and needs changing. Thanks once again for the package.

m <- move(lu$location.long, lu$location.lat, proj=CRS("+proj=longlat +ellps=WGS84"), time = lu$timestamp, animal=lu$individual.local.identifier, data=lu)

Error in validityMethod(as(object, superClass)) :
The dataset includes timestamps that are not ascending

frames_spatial unable to work on tracks less than one minute

Hello,
I was recently working on insect flight tracks. Some of the tracks were less than a minute, which were not able to be processed by "frames_spatial". I have done a workaround by adding an additional time point to extend the track to at least a minute.
Based on the error message, it suggests an internal check at play?
"Error in seq.POSIXt(min(do.call(c, ts), na.rm = T), max(do.call(c, ts), :
'by' must be of length 1"
Attached is a reproducible R script in .txt that shows the issue with a sample track of 59 secs and another of 60 secs. The former will fail while the latter will have no issues.
May I seek your help please?

reproducible_moveVIS.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.