h-a-graham / rayvista

An R plugin for {rayshader} to view a 3D vista anywhere on earth.
GNU General Public License v3.0
107 stars 5 forks source link

Bad data in example #35

Closed apsteinmetz closed 2 years ago

apsteinmetz commented 2 years ago

This is a wonderful package because it "just works" and simply returns all the pieces needed for great visualizations. Thanks!

The example now breaks because the DEM that's retrieved contains some crazy negative elevations. This results in the render appearing as an enormously tall box with the wee bitty terrain sitting on top. Using show_vista = FALSE, this fixes it:

.lat <- 57.21956608144513
.long <- -6.092690805001252

cuillins <- plot_3d_vista(lat = .lat, long = .long,show_vista = FALSE)

# set negative elevations to zero
cuillins$dem_matrix[cuillins$dem_matrix < 0] <- 0

rgl::clear3d()
cuillins$texture %>%
  plot_3d(cuillins$dem_matrix)
rayshader::render_snapshot(clear=TRUE)
h-a-graham commented 2 years ago

Thanks very much @apsteinmetz! You are correct - for some reason this happens with the AWS data and I guess it get's updated fairly regularly so errors creep in. I have now added the use of the outler_filter into the example.

It can be used like so: cuillins <- plot_3d_vista(lat = .lat, long = .long, phi=30, outlier_filter=0.001)

I also found some changes in the other examples too so thanks for reminding me to update this.

Cheers