library(sf)
support <- st_as_sf(
data.frame(region = c("A", "B")),
geometry = st_sfc(
st_polygon(list(cbind(c(0, 10, 10, 0, 0), c(0, 0, 10, 10, 0)))),
st_polygon(list(cbind(c(15, 25, 25, 15, 15), c(0, 0, 10, 10, 0))))
),
crs = 32631
)
pts <- st_as_sf(
data.frame(id = 1:4),
geometry = st_sfc(
st_point(c(5, 5)),
st_point(c(12, 5)),
st_point(c(20, 5)),
st_point(c(27, 5))
),
crs = 32631
)
result <- aoe(pts, support)
# Get AoE polygons
aoe_polys <- aoe_geometry(result, "aoe")
# Get both original and AoE for comparison
both <- aoe_geometry(result, "both")
# Filter to one support (uses row names as support_id)
region_1 <- aoe_geometry(result, "aoe", support_id = "1")
Run the code above in your browser using DataLab