requireNamespace("ggplot2", quietly = TRUE)
library(sf, quietly = TRUE)
library(ggplot2)
bbx <- matrix(c(697047,9553483,
696158,9560476,
700964,9561425,
701745,9555358),
byrow = TRUE,
ncol = 2)
bbx <- st_multipoint(bbx)
bbx <- st_cast(bbx,"POLYGON")
bbx <- st_sfc(bbx, crs = 31992)
set.seed(1234)
points <- st_sf(geometry = st_sample(bbx, 100))
SD_BOX <- st_sd_box(points)
ggplot() +
geom_sf(data = SD_BOX, fill = NA, color = "darkolivegreen") +
geom_sf(data = points, color = "steelblue", size = 0.5)
Run the code above in your browser using DataLab