sf_voronoi_diagram {sdsfun} | R Documentation |
Generates Voronoi diagram (Thiessen polygons) for sf object
sf_voronoi_diagram(sfj)
sfj |
An |
An sf
object of polygon geometry type.
Only sf objects of (multi-)point type are supported to generate voronoi diagram and the returned result includes only the geometry column.
library(sf)
pts = read_sf(system.file('extdata/pts.gpkg',package = 'sdsfun'))
pts_v = sf_voronoi_diagram(pts)
library(ggplot2)
ggplot() +
geom_sf(data = pts_v, color = 'red',
fill = 'transparent') +
geom_sf(data = pts, color = 'blue', size = 1.25) +
theme_void()