cut_polygons_to_sf: cut_polygons_to_sf

Description Usage Arguments Value Examples

View source: R/cut_polygons_to_sf.R

Description

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.

Usage

1

Arguments

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

Value

sf object with one row for each 2D polygon

Examples

 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))

nevrome/bleiglas documentation built on Sept. 19, 2021, 3:12 p.m.