SymbolixAU / mapdeck

R interface to Deck.gl and Mapbox
https://symbolixau.github.io/mapdeck/articles/mapdeck.html
362 stars 40 forks source link

R Session Aborted during Mapdeck call #362

Closed Phil-Longenecker-APD closed 1 year ago

Phil-Longenecker-APD commented 1 year ago

Describe the bug When I try to add arcs, lines, animated lines, (everything except polygons) to a mapdeck call, my R session aborts. Scripts I know worked in the past no longer work, and even the example from the site below seems to abort. Not sure what changed/ if the issues is on my end. Printing session info below - I think I have everything up to date?

Love the package, and hope to keep using it!

To Reproduce

library(sf)
library(mapdeck)

# initialize a map
mapdeck::set_token("pk.eyJ1IjoicGhpbGlwbG9uZ2VuZWNrZXIiLCJhIjoiY2xlZ2hqNmVtMTBzdjNvbXIxdGxvdHo5MiJ9.cqiQt41C4Kr2-yU1yG7Q8w")  ## set your mapbox token here

url <- 'https://raw.githubusercontent.com/plotly/datasets/master/2011_february_aa_flight_paths.csv'
flights <- read.csv(url)
flights$id <- seq_len(nrow(flights))
flights$stroke <- sample(1:3, size = nrow(flights), replace = T)
flights$info <- paste0("<b>",flights$airport1, " - ", flights$airport2, "</b>")

mapdeck( style = mapdeck_style("dark"), pitch = 45 ) %>%
  add_arc(
    data = flights
    , layer_id = "arc_layer"
    , origin = c("start_lon", "start_lat")
    , destination = c("end_lon", "end_lat")
    , stroke_from = "airport1"
    , stroke_to = "airport2"
    , stroke_width = "stroke"
    , tooltip = "info"
    , auto_highlight = TRUE
    , legend = T
    , legend_options = list(
      stroke_from = list( title = "Origin airport" ),
      css = "max-height: 100px;")
  )

Expected behaviour A mapdeck map with arcs, animated arcs, etc.

Versions

> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10        pillar_1.8.1       compiler_4.2.2     class_7.3-21      
 [5] tools_4.2.2        uuid_1.1-0         digest_0.6.31      jsonlite_1.8.4    
 [9] lifecycle_1.0.3    tibble_3.1.8       pkgconfig_2.0.3    rlang_1.0.6       
[13] cli_3.6.0          DBI_1.1.3          rstudioapi_0.14    fastmap_1.1.0     
[17] e1071_1.7-13       dplyr_1.1.0        httr_1.4.4         stringr_1.5.0     
[21] xml2_1.3.3         sfheaders_0.4.0    hms_1.1.2          generics_0.1.3    
[25] tidycensus_1.3.2   vctrs_0.5.2        htmlwidgets_1.6.1  rappdirs_0.3.3    
[29] tigris_2.0.1       classInt_0.4-8     grid_4.2.2         tidyselect_1.2.0  
[33] glue_1.6.2         sf_1.0-9           R6_2.5.1           fansi_1.0.4       
**[37] mapdeck_0.3.4**      tzdb_0.3.0         readr_2.1.4        tidyr_1.3.0       
[41] purrr_1.0.1        magrittr_2.0.3     ellipsis_0.3.2     htmltools_0.5.4   
[45] units_0.8-1        rvest_1.0.3        utf8_1.2.3         KernSmooth_2.23-20
[49] proxy_0.4-27       stringi_1.7.12     crayon_1.5.2 
dcooley commented 1 year ago

The first thing I'd like you to try is to re-install the dependency sfheaders. This has just been updated on CRAN to 0.4.2 due to a CRAN policy update about C++. And an 'aborted' session usually comes from C++ code.

Phil-Longenecker-APD commented 1 year ago

That solved it! Thank you so much!