tylermorganwall / rayshader

R Package for 2D and 3D mapping and data visualization
https://www.rayshader.com/
2.06k stars 214 forks source link

Error in t.default(cbind(baselist$edge_heights, baselist$edge_heights, : argument is not a matrix #266

Closed 122-TheodoreLEHOUX closed 1 year ago

122-TheodoreLEHOUX commented 1 year ago

Description

Hello and thanks for your library it's awesome ! I think I encounter an installlation bug. I tried running the example code on https://www.rayshader.com/. For 2d map no problem but when I use plot_3d(), I get this error message : Error in t.default(cbind(baselist$edge_heights, baselist$edge_heights, : argument is not a matrix. It's exactly the same as on the website. It still open the RGL window with modelisation but the ending of the code is not executed.

Session Info R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

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

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

other attached packages: [1] forcats_1.0.0 stringr_1.5.0 dplyr_1.0.10 purrr_1.0.1 [5] readr_2.1.3 tidyr_1.3.0 tibble_3.1.8 ggplot2_3.4.0 [9] tidyverse_1.3.2 osmdata_0.1.10 rayshader_0.34.5 raster_3.6-14
[13] sp_1.6-0 geoviz_0.2.2 rgl_1.0.1 sf_1.0-9 [17] here_1.0.1

loaded via a namespace (and not attached): [1] httr_1.4.4 jsonlite_1.8.4 foreach_1.5.2 [4] modelr_0.1.10 assertthat_0.2.1 googlesheets4_1.0.1 [7] cellranger_1.1.0 progress_1.2.2 pillar_1.8.1 [10] backports_1.4.1 lattice_0.20-45 glue_1.6.2 [13] digest_0.6.31 rvest_1.0.3 colorspace_2.1-0 [16] htmltools_0.5.4 pkgconfig_2.0.3 broom_1.0.3
[19] magick_2.7.3 haven_2.5.1 scales_1.2.1 [22] terra_1.7-3 tzdb_0.3.0 timechange_0.2.0 [25] proxy_0.4-27 googledrive_2.0.0 generics_0.1.3 [28] ellipsis_0.3.2 withr_2.5.0 cli_3.6.0 [31] magrittr_2.0.3 crayon_1.5.2 readxl_1.4.1 [34] fs_1.6.0 fansi_1.0.4 doParallel_1.0.17 [37] xml2_1.3.3 class_7.3-20 httr2_0.2.2 [40] tools_4.2.2 prettyunits_1.1.1 hms_1.1.2 [43] gargle_1.3.0 lifecycle_1.0.3 munsell_0.5.0 [46] reprex_2.0.2 compiler_4.2.2 e1071_1.7-12
[49] rlang_1.0.6 classInt_0.4-8 units_0.8-1 [52] grid_4.2.2 iterators_1.0.14 rappdirs_0.3.3 [55] htmlwidgets_1.6.1 base64enc_0.1-3 gtable_0.3.1 [58] codetools_0.2-18 curl_5.0.0 DBI_1.1.3 [61] rayimage_0.9.1 R6_2.5.1 lubridate_1.9.1
[64] rgdal_1.6-4 knitr_1.42 fastmap_1.1.0 [67] utf8_1.2.2 rprojroot_2.0.3 KernSmooth_2.23-20 [70] stringi_1.7.12 parallel_4.2.2 Rcpp_1.0.10 [73] png_0.1-8 vctrs_0.5.2 dbplyr_2.3.0 [76] tidyselect_1.2.0 xfun_0.36

Reproducible Example

library(rayshader)

loadzip = tempfile() 
download.file("https://tylermw.com/data/dem_01.tif.zip", loadzip)
localtif = raster::raster(unzip(loadzip, "dem_01.tif"))
unlink(loadzip)

elmat = raster_to_matrix(localtif)

elmat %>%
  sphere_shade(texture = "desert") %>%
  add_water(detect_water(elmat), color = "desert") %>%
  add_shadow(ray_shade(elmat, zscale = 3), 0.5) %>%
  add_shadow(ambient_shade(elmat), 0) %>%
  plot_3d(elmat, zscale = 10, fov = 0, theta = 135, zoom = 0.75, phi = 45, windowsize = c(1000, 800))
Sys.sleep(0.2)
render_snapshot()
122-TheodoreLEHOUX commented 1 year ago

Bad installation from me