Description Usage Arguments Value Examples
View source: R/cut_polygons_to_sf.R
Transform the polygon cut slices to the sf format. This only makes sense if the x and y coordinate of your input dataset are spatial coordinates.
1 | cut_polygons_to_sf(x, crs)
|
x |
list of lists of data.tables. Output of cut_polygons |
crs |
coordinate reference system of the resulting 2D polygons. Integer with the EPSG code, or character with proj4string |
sf object with one row for each 2D polygon
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | random_unique_points <- unique(data.table::data.table(
id = NA,
x = runif(10, 0, 100000),
y = runif(10, 0, 100000),
z = runif(10, 0, 100)
))
random_unique_points$id <- seq_len(nrow(random_unique_points))
voro_output <- tessellate(random_unique_points, unit_scaling = c(0.001, 0.001, 1))
polygon_points <- read_polygon_edges(voro_output)
cut_surfaces <- cut_polygons(polygon_points, c(20, 40, 60))
cut_surfaces_sf <- cut_polygons_to_sf(cut_surfaces, crs = 25832)
polygons_z_20 <- sf::st_geometry(cut_surfaces_sf[cut_surfaces_sf$z == 20, ])
plot(polygons_z_20, col = sf::sf.colors(10, categorical = TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.