Closed mariepastora closed 2 years ago
Hi again, after a bit of struggle it looks like my issue was a projection issue, along with the extent not being the same exact size as plot_3d_vista(). I've successfully generated polygons, but they appear to be upside down:
when fiddling with the top
and bottom
parameters of render_polygons
, it gets partially solved, but just offsets the polygon quite dramatically.
Everything is in EPSG 4326, so I doubt it's a projection issue now. Any clue on what might be happening? Is there a way to use rayvista with generate_overlay()
from rayshader instead?
Thanks so much!
Hi Marie, thanks for this issue. This is possible, but I'll admit that it is unintuitive and the documentation really isn't helpful so here is a reprex which should hopefully give you an idea of what you need. FYI, I am working an alternative to {rayvista} which should make these kind of things much simpler and more in keeping with a typical {rayshader} workflow.
library(rayvista)
library(rayshader)
library(sf)
demo(nc, ask = FALSE, echo = FALSE)
nc
nc_layers <- plot_3d_vista(req_area = nc, elevation_detail = 5,
overlay_detail = 8, show_vista = F)
# overlay example
nc_layers$texture %>%
add_overlay(., generate_polygon_overlay(nc,
extent=attr(nc_layers$dem_matrix, 'extent'),
heightmap = nc_layers$dem_matrix,
palette = NA)) %>%
plot_3d(nc_layers$dem_matrix, zscale=100)
# rgl::clear3d()
# render_polygons example
nc_layers2 <- plot_3d_vista(req_area = nc, elevation_detail = 5,
overlay_detail = 8, show_vista = T, zscale=100)
render_polygons(nc, attr(nc_layers2, 'extent'), data_column_top='AREA',
scale=100)
Please let me know if this solves things or if you have any other questions, Cheers, Hugh
Wow thank you this worked wonders! Thank you for taking the time, and can't wait to see the alternative to rayvista, too.
Hello, This is such a great package -- thanks for writing it! I'm trying to use
render_polygons()
on top of aplot_3d_vista()
, and getting the following error message:I'm not sure of what's happening here. My polygon is a Simple Feature looking like this:
Its datum is WGS84.
I'm calling render_polygons like this:
cropped_dem
being an elevation raster in WGS84 that is a bit larger than the area generated viaplot_3d_vista
. Would you have any idea of what might be happening? Thanks so much!