Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Error from frame_spatial #122

Open
smerker opened this issue Oct 5, 2023 · 6 comments
Open

Fatal Error from frame_spatial #122

smerker opened this issue Oct 5, 2023 · 6 comments

Comments

@smerker
Copy link

smerker commented Oct 5, 2023

I am trying animate a single individual's movements over some hybrid or satellite data.
Occasionally I run into a fatal error that crashes R. I thought it was memory related because I was creating a move object with large number of features. Anytime I had a <200 features it seems to work. I've since tried adjusting the resolution to 1 day, resulting in 14 features and still get crashes. There are no warnings or clear reasons why this crashes R, but it is highly annoying. Again I thought it was memory related but I've tried scrubbing the memory and running things pretty bare bones. I also have a large amount of RAM available so it seems more likely to be some other problem.

head(Hartpond.nodup)
    Latitude Longitude Altitude Speed            DateTime trackID
102 41.78707 -73.30113      283   0.3 2022-04-23 10:07:14       1
107 41.78646 -73.30147      420  0.41 2022-04-23 11:07:44       1
128 41.78634 -73.30259      458  0.08 2022-04-23 12:07:55       1
149 41.78674 -73.30194      308  0.13 2022-04-23 13:08:06       1
170 41.78659 -73.30194      419  0.26 2022-04-23 14:08:16       1
191 41.78613 -73.30147      453  0.03 2022-04-23 15:08:28       1

Hartpond.move<-df2move(Hartpond.nodup[1:200, c(2:5,21,22)],
                       proj = "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 +proj=longlat", 
                       x = "Longitude", y = "Latitude", time = "DateTime", track_id = "trackID")

Hartpond.move

class       : Move 
features    : 200 
extent      : -73.30486, -73.29762, 41.78171, 41.78829  (xmin, xmax, ymin, ymax)
crs         : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 +proj=longlat 
variables   : 3
names       :         x,        y,       time 
min values  : -73.30486, 41.78171, 1650722834 
max values  : -73.29762, 41.78829, 1651938652 
timestamps  : 2022-04-23 10:07:14 ... 2022-05-07 11:50:52 Time difference of 14 days  (start ... end, duration) 
sensors     : unknown 
indiv. data :  
indiv. value:  
date created: 2023-09-27 22:27:11 

m <- align_move(Hartpond.move, res = 30, unit = "mins")
m

class       : MoveStack 
features    : 675 
extent      : -73.30485, -73.29787, 41.78179, 41.78776  (xmin, xmax, ymin, ymax)
crs         : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 +proj=longlat 
variables   : 3
names       :                 x,                y,       time 
min values  : -73.3048487571596, 41.7817912528116, 1650724620 
max values  : -73.2978741303825, 41.7877643022963, 1651937820 
timestamps  : 2022-04-23 10:37:00 ... 2022-05-07 11:37:00 Time difference of 14 days  (start ... end, duration) 
sensors     : interpolateTime 
indiv. data :  
individuals : X1 
date created: 2023-09-27 22:27:11

**Fails here. This primarily seems to work when there are very few features, but it's not always the case.**

frames <- frames_spatial(m, map_service = "mapbox", map_type = "hybrid", map_token = ambi.token, ext=Hartpond.ext, path_colours = c("darkorange"),
                         alpha = .95) %>% 
  add_labels(x = "Longitude", y = "Latitude") %>% # add some customizations, such as axis labels
  add_northarrow() %>% 
  add_scalebar() %>% 
  add_timestamps(type = "label") %>% 
  add_progress()

Just found out this still fails if I use maps saved to a directory. It has to be possible to plot hundreds of features yes?

Let me know if you need other info.

@vparmain
Copy link

Hello,
It seems that I encounter the same type of crash.
I use R4.3.0 , Rstudio and move Vis 0.10.6

Data:
anim.zip

Code for reproductible example:
library(moveVis)
anim <- readRDS("./anim.rds")

anim<- df2move(df=anim, proj= "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 +proj=longlat",
x="x_", y="y_", time= "GMTTime", track_id="trackId")

anim <- align_move(anim, res = 2, unit = "mins")

frames <- frames_spatial(anim,service="osm",map_type="streets",
path_fade = T, trace_show = T)%>%
add_northarrow(height = 0.05, position = "upperright")%>%
add_progress(size = 3)%>%
add_timestamps(type = "label")%>%
add_scalebar(colour = "white")

Crashes here without any comment while data("move_data") from your package is like a charm.
Many thanks for your help.

@JoChambon
Copy link

Hi, reinstalling the package from github with devtools rather than install.packages() solved this issue.
devtools::install_github("16EAGLE/moveVis")

@ErikaPeirce-USDA
Copy link

Using R version 4.3.2 and downloaded version from devtools::install_github("16EAGLE/moveVis")

I am getting similar issues when running frame_spatial when I use map_service:

frames <- frames_spatial(data_align, path_colours = c("red","blue","darkgreen","coral","blueviolet","orange"),
                         map_service = "mapbox", map_type = "streets",
                         map_token = token, 
                         equidistant = FALSE, path_fade = F, trace_show = T, 
                         tail_size = 0.8)

Versus when I use osm I do not get the fatal error message.

frames <- frames_spatial(data_align, path_colours = c("red","blue","darkgreen","coral","blueviolet","orange"),
                         map_service = "osm", map_type = "streets",
                         equidistant = FALSE, path_fade = F, trace_show = T, 
                         tail_size = 0.8)

What could be going on to cause this? I'd like to be able to continue using mapbox.

Thanks!

@smerker
Copy link
Author

smerker commented Dec 7, 2023

The proposed solution of reinstalling via devtools doesn't work. Still receive a fatal error with no explanation of what went wrong.

@smerker
Copy link
Author

smerker commented Dec 7, 2023

I can only get this to work if the number of features is very small. Which doesn't make sense because the data provided has quite a few features.

@Purple533
Copy link

I encountered the same issue. I tried with both install.package() and reintalled with devtools, and switched between different map_services. None seemed to be working. I can only get the frames_spatial running if using 3 or fewer animals movement data. Every time I added the 4th one, R faced a fatal error and crashed itself. And I only have around 200 points for each animal.

Any help is appreciated!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants