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

Monterey Bay render_polygons example not working? [BUG] #309

Open
srdurham opened this issue Apr 8, 2024 · 0 comments
Open

Monterey Bay render_polygons example not working? [BUG] #309

srdurham opened this issue Apr 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@srdurham
Copy link

srdurham commented Apr 8, 2024

I am getting an error when running the render_polygons() function. I tried using the code example from www.rayshader.com and I still get the same error: "Error in { : task 1 failed - "argument is not a matrix". I tested plotting the "mont_county_buff" object alone using mapview, and it looks fine, so I think the issue is with render_polygons(), but please let me know if you see something I am doing wrong. Thank you.

Here is my session info:

sessionInfo()
R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

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

time zone: America/Chicago
tzcode source: internal

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

other attached packages:
[1] rayshader_0.38.0

loaded via a namespace (and not attached):
[1] utf8_1.2.4 generics_0.1.3 class_7.3-22 KernSmooth_2.23-22 lattice_0.22-5 extrafontdb_1.0
[7] hms_1.1.3 digest_0.6.35 magrittr_2.0.3 rgl_1.3.1 grid_4.3.3 iterators_1.0.14
[13] fastmap_1.1.1 foreach_1.5.2 doParallel_1.0.17 rprojroot_2.0.4 jsonlite_1.8.8 progress_1.2.3
[19] e1071_1.7-14 DBI_1.2.2 fansi_1.0.6 scales_1.3.0 codetools_0.2-19 cli_3.6.2
[25] rlang_1.1.3 crayon_1.5.2 units_0.8-5 munsell_0.5.1 base64enc_0.1-3 tools_4.3.3
[31] raster_3.6-26 parallel_4.3.3 dplyr_1.1.4 colorspace_2.1-0 here_1.0.1 png_0.1-8
[37] vctrs_0.6.5 R6_2.5.1 magick_2.8.3 proxy_0.4-27 lifecycle_1.0.4 classInt_0.4-10
[43] htmlwidgets_1.6.4 pkgconfig_2.0.3 terra_1.7-71 pillar_1.9.0 glue_1.7.0 Rcpp_1.0.12
[49] sf_1.0-15 xfun_0.43 tibble_3.2.1 tidyselect_1.2.1 rstudioapi_0.15.0 knitr_1.46
[55] extrafont_0.19 htmltools_0.5.8.1 Rttf2pt1_1.3.12 compiler_4.3.3 prettyunits_1.2.0 sp_2.1-3

Reproducible Example:

#Example code from www.rayshader.com where I get the error.
library(rayshader)
montereybay %>%
  sphere_shade(texture = "desert") %>%
  add_shadow(ray_shade(montereybay,zscale=50)) %>%
  plot_3d(montereybay,water=TRUE, windowsize=c(1000,800), watercolor="dodgerblue")
render_camera(theta=-60,  phi=60, zoom = 0.85, fov=30)

sf::sf_use_s2(FALSE) 
mont_county_buff = sf::st_simplify(sf::st_buffer(monterey_counties_sf,-0.003), dTolerance=0.004)

render_polygons(mont_county_buff,  
                extent = attr(montereybay,"extent"), data_column_top = "ALAND",
                scale_data = 300/(2.6E9), color="chartreuse4",
                parallel=TRUE)


#plotting 'mont_county_buff' with mapview (works fine for me)
mapview::mapview(mont_county_buff)
@srdurham srdurham added the bug Something isn't working label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant