How to plot polygons in shapefile with z coordinate in 3D using rayshader

318 Views Asked by At

I have a .shp file with polygons having z value on every coordinate.

enter image description here

I want to represent this shp file in 3d format where I could see the height applied to each polygon in 3D. There is a tool Arcscene which does the same thing

enter image description here

but I want to achieve same functionality with R. I was reading about the rayshader library but I don't seem to find the correct solution for this use case.

What I tried is this

library(sf)
library(ggplot2)
library(rayshader)
nc <- st_read("shp/allpolygons.shp")
#plot(st_zm(nc), max.plot = 1)
gg_usa = ggplot(st_zm(nc)) + geom_sf()
plot_gg(gg_usa,multicore = TRUE,width=5,height=5,
        scale=250,windowsize=c(1400,866),zoom = 0.55, phi = 30)
render_polygons()

which gives me output as this

enter image description here

which is not what I am looking for. What is the correct way to do this with rayshader or any other library?

0

There are 0 best solutions below