# NOT RUN {
# 1. create voronoi polygons programmatically
coords <- data.frame(x = c(40, 70, 70, 50),
y = c(40, 40, 60, 70))
window <- data.frame(x = c(0, 80),
y = c(0, 80))
aGeom <- gs_point(anchor = coords, window = window)
visualise(voronoi = aGeom)
tiles <- gs_voronoi(anchor = aGeom)
visualise(tiles, new = FALSE)
# }
# NOT RUN {
# 2. sketch a voronoi polygon by clicking into a template
gs_voronoi(sketch = gtRasters$continuous) %>%
visualise(tiles = ., new = FALSE)
# }
Run the code above in your browser using DataLab