| aoe | R Documentation |
Given a set of points and one or more support polygons, aoe() classifies
points as "core" (inside original support) or "halo" (inside the area of
effect but outside original support), pruning all points outside.
aoe(
points,
support = NULL,
scale = NULL,
area = NULL,
method = c("buffer", "stamp"),
reference = NULL,
mask = NULL,
largest_polygon = TRUE,
coords = NULL
)
points |
An |
support |
One of:
|
scale |
Numeric scale factor (default
For For Cannot be used together with |
area |
Numeric area proportion (alternative to Unlike Cannot be used together with |
method |
Method for computing the area of effect:
|
reference |
Optional If |
mask |
Optional mask for clipping the area of effect. Can be:
|
largest_polygon |
Logical (default |
coords |
Column names for coordinates when |
By default, the area of effect is computed using a buffer that produces equal core and halo areas. This means the AoE has twice the area of the original support, split evenly between core (inside) and halo (outside).
Computes a uniform buffer distance d such that the buffered area
equals the target. The buffer distance is found by solving:
\pi d^2 + P \cdot d = A_{target}
where P is the perimeter and A_{target} is the desired halo area.
Applies an affine transformation to each vertex:
p' = r + (1 + s)(p - r)
where r is the reference point (centroid), p is each vertex,
and s is the scale factor. This method preserves shape proportions
but only guarantees the AoE contains the original for star-shaped polygons
(where the centroid can "see" all boundary points).
Points exactly on the original support boundary are classified as "core".
The support geometry is validated internally using sf::st_make_valid().
An aoe_result object (extends sf) containing only the supported
points, with columns:
Original point identifier (row name or index)
Identifier for which support the classification refers to
Classification: "core" or "halo"
When multiple supports are provided, points may appear multiple times (once per support whose AoE contains them).
The result has S3 methods for print(), summary(), and plot().
Use aoe_geometry() to extract the AoE polygons.
library(sf)
# Single support
support <- st_as_sf(
data.frame(id = 1),
geometry = st_sfc(st_polygon(list(
cbind(c(0, 10, 10, 0, 0), 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(2, 2)),
st_point(c(15, 5)),
st_point(c(30, 30))
),
crs = 32631
)
result <- aoe(pts, support)
# Multiple supports (e.g., admin regions)
supports <- 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(8, 18, 18, 8, 8), c(0, 0, 10, 10, 0))))
),
crs = 32631
)
result <- aoe(pts, supports)
# Points near the boundary may appear in both regions' AoE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.