16EAGLE / moveVis

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.
http://www.movevis.org
GNU General Public License v3.0
131 stars 20 forks source link

error related to "crop" in frames_spatial() #94

Open bjpadilla opened 3 years ago

bjpadilla commented 3 years ago

Hi, I am relatively new to moveVis and I love it! But, I keep running into an odd error that I cant quite wrap my head around. This comes after creating an aligned move track through df2move and align_move() when I attempt to create spatial frames. Code, with error below. Thanks!

`bull_frames <- frames_spatial( m = mv_bull, map_service = "mapbox", map_type = "satellite", map_token = "pk.eyJ1IjoiaGVsaW9ybmlzIiwiYSI6ImNqNGtjZjE1cjBoYmcycXAzbmlmNmJieGEifQ.ERz0DjQKEE1PBd7myLKwZA", path_colours = magma(1), path_legend = TRUE, alpha = 0.75) %>% add_labels(x = "Longitude", y = "Latitude") %>% add_scalebar(height = 0.01) %>% add_timestamps(type = "label") %>% add_progress()

Checking temporal alignment... Processing movement data... Approximated animation duration: ≈ 9.72s at 25 fps for 243 frames Retrieving and compositing basemap imagery... |========================================================================================| 100% elapsed=00s
Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'crop': missing value where TRUE/FALSE needed In addition: Warning message: In dim<-(*tmp*, value = c(nr, nc)) : NAs introduced by coercion to integer range `

Kdorrick commented 2 years ago

I'm having a similar issue and it's occurring when I run the code for the example data provided:

create spatial frames with a OpenStreetMap watercolour map

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

Which I then receive: Checking temporal alignment... Processing movement data... Approximated animation duration: ≈ 7.2s at 25 fps for 180 frames Retrieving and compositing basemap imagery... |====================================================================================| 100% elapsed=00s

Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'crop': unable to find an inherited method for function ‘xmax’ for signature ‘"data.frame"’.

Perhaps related, I also receive a warning when I run the following code:

m <- moveVis:: align_move(move_data, res = 4, unit = "mins")

Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) : Discarded datum WGS_1984 in Proj4 definition, but +towgs84= values preserved

HansMartinMT commented 2 years ago

I think this issue is the result of a namespace conflict with the crop function. My conflict resulted from loading the ctmm package.