save_multipolygonz_to_obj: Save MULTIPOLYGON Z sf data to OBJ file

View source: R/save_multipolygonz_to_obj.R

save_multipolygonz_to_objR Documentation

Save MULTIPOLYGON Z sf data to OBJ file

Description

Converts MULTIPOLYGON Z features into a 3D OBJ model

Usage

save_multipolygonz_to_obj(sfobj, filename, swap_yz = FALSE)

Arguments

sfobj

sf object with MULTIPOLYGON Z geometry,

filename

Filename of the OBJ to save the 3D model to.

swap_yz

Default 'TRUE'., Whether to swap and Y and Z axes. (Y axis is vertical in rayshader coordinates, but data is often provided with Z being vertical).

Examples

#Convert the built-in Washington Monument MULTIPOLYGON Z data to an OBJ file
obj_temp = tempfile(fileext=".obk")
save_multipolygonz_to_obj(washington_monument_multipolygonz, obj_temp, swap_yz=TRUE)
#Render with rgl
rgl::open3d()
render_obj(filename=obj_temp, xyz=matrix(c(0,0,0),ncol=3), color="red")
render_camera(theta=30,phi=40)

rayshader documentation built on May 29, 2024, 3:03 a.m.