I’m trying to make a 3D OBJ file using R. My initial data is a Geopackage with multiple polygons. And I want to ‘extrude’ each polygon to make them 3d. The extrude amount should be determined by the value of an attribute of these polygons.
I have a geopackage with multiple polygons: Screenshot of data list. I am able to plot this data in 2d. 2d plot of data
Each of these polygons has an attribute called ‘POINT…50’. I want to use the value of this attribute to determine the height ( z axis) of each polygon by extruding each polygon, but I can’t get it to work. So far I have tried to do it with the extrude3d function.
Here is my initial data . Here is my code so far :
library(sf)
library(ggplot2)
library(rgl)
library(dplyr)
data <- st_read("data/métropole_de_lyon_LGT_LCI_500m.gpkg")
data|>
ggplot() +
geom_sf()
data |>
extrude3d()
writeOBJ(data3D, '3d model')
I have also used the rayshader package to create a 3d visualization but the problem it that it rasterizes the data so the OBJ file it outputs is not satisfactory. So i want the same result but only using vector to have a clean 3D mesh. 3D visualisation made with rayshader The goal is to have a clean mesh like this one: Clean mesh
elwwan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.