0

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?

stefan
  • 90,330
  • 6
  • 25
  • 51
user1298426
  • 3,467
  • 15
  • 50
  • 96
  • It's not clear what you want to do. Can you make a simple .shp file available somewhere, and show us the output you want from that? – user2554330 Dec 17 '22 at 13:58
  • ok I will try that but what I want is to visualize polygons in 3d with heights as per z coordinates. – user1298426 Dec 17 '22 at 14:06
  • The unclear part is what the heights apply to. Is there one height per polygon, or one height per vertex? In the latter case, how are the heights interpolated within the polygon? – user2554330 Dec 17 '22 at 14:18
  • The heights apply to each coordinate of a polygon as shown in the first image. If you consider a polygon as a bridge/tunnel then the polygon should look like going up/down. – user1298426 Dec 17 '22 at 14:25

0 Answers0