Closed ixodid198 closed 5 years ago
You just need to adjust the zscale argument in both sphere_shade and plot_3d to something lower (which in plot_3d increases the vertical exaggeration, and in sphere_shade maps the points to a wider range of colors):
library(magrittr)
library(rayshader)
library(elevatr)
library(sf)
# Create Simple Feature Geometry (sfg) Polygon around GG Bridge
gg_sfg <- st_polygon(list(cbind(c(-122.56, -122.56, -122.41, -122.41, -122.56), c(37.88, 37.77, 37.77, 37.88, 37.88))))
# Add projection info by creating an sfc object
gg_sfc <- st_sfc(gg_sfg, crs = "+init=epsg:4326")
# Create simple feature dataframe. Now can use with elevatr::get_elev_raster to get elevation data
gg_sf <- st_sf(gg_sfc)
# Get elevation data around the Golden Gate Bridge
elevation <- get_elev_raster(gg_sf, z = 13, src = "aws")
elmat2 = matrix(raster::extract(elevation, raster::extent(elevation), buffer = 10000),
nrow = ncol(elevation), ncol = nrow(elevation))
# Use same parameters as 3D Monterey Bay rendering
shadow = ray_shade(elmat2, zscale = 50, lambert = FALSE, multicore = TRUE)
amb = ambient_shade(elmat2, zscale = 50, multicore = FALSE)
elmat2 %>%
sphere_shade(zscale = 0.5, texture = "imhof1") %>%
add_shadow(shadow, 0.5) %>%
add_shadow(amb) %>%
plot_3d(elmat2, zscale = 2, fov = 0, theta = -20, phi = 45, windowsize = c(1000, 800), zoom = 0.75,
water = TRUE, waterdepth = 0, wateralpha = 0.5, watercolor = "lightblue",
waterlinecolor = "white", waterlinealpha = 0.3)
render_snapshot()
However, the interesting arrangement of your matrix (values surrounded by a border of NAs) did allow me to find a previously unknown memory access bug in the water layer generation, so update before trying again.
I originally posted this here but the issue was closed so I was unsure if anybody saw my message.
@tylermorganwall I am receiving the same error as @nitschkematthew even though I ensure that the previously rendered 3D map window is closed.
I am using data around the Golden Gate Bridge from library(elevatr) with the same parameters you used to create Monterey Bay.
When rendering the 3D map I receive this error:
Why is there no 3D base or white water line? Is that related to the error I'm getting? Also, the land looks different from your Monterey example. And the water has barely any relief at all. Still, there is more contrast in the Monterey Bay image than in the SF Bay image. I think I'm missing something.