| aoe_border | R Documentation |
Given a set of points and a border (line), aoe_border() classifies
points by their side relative to the border and their distance from it.
Creates equal-area buffer zones on both sides of the border.
aoe_border(
points,
border,
width = NULL,
area = NULL,
halo_width = NULL,
halo_area = NULL,
mask = NULL,
bbox = NULL,
side_names = c("side_1", "side_2"),
coords = NULL
)
points |
An |
border |
An |
width |
Buffer width in meters (for projected CRS) or degrees (for
geographic CRS). Creates core zone within this distance of the border.
Cannot be used together with |
area |
Target area for each side's core zone. The function finds the
buffer width that produces this area per side. If |
halo_width |
Width of the halo zone beyond the core. If |
halo_area |
Target area for each side's halo zone. Alternative to
|
mask |
Optional mask for clipping the buffer zones. Can be:
|
bbox |
Optional bounding box to limit the study area. Can be:
|
side_names |
Character vector of length 2 naming the sides.
Default is |
coords |
Column names for coordinates when |
The function creates symmetric buffer zones around a border line:
Core zone: Points within width (or area) distance of the border
Halo zone: Points beyond core but within width + halo_width
Pruned: Points outside the halo zone (not returned)
Each zone is split by the border line to determine which side the point falls on.
When using the area parameter, the buffer width is calculated to produce
equal area on both sides of the border. With masking, the width is adjusted
so that the masked area on each side equals the target.
An aoe_border_result object (extends sf) containing classified
points with columns:
Original point identifier
Which side of the border: value from side_names
Distance class: "core" or "halo"
Points outside the study area are pruned (not returned).
library(sf)
# Create a border line
border <- st_as_sf(
data.frame(id = 1),
geometry = st_sfc(st_linestring(matrix(
c(0, 0, 100, 100), ncol = 2, byrow = TRUE
))),
crs = 32631
)
# Create points
pts <- st_as_sf(
data.frame(id = 1:6),
geometry = st_sfc(
st_point(c(10, 20)), # near border, side 1
st_point(c(30, 10)), # near border, side 2
st_point(c(50, 80)), # far from border, side 1
st_point(c(80, 40)), # far from border, side 2
st_point(c(5, 5)), # very close to border
st_point(c(200, 200)) # outside study area
),
crs = 32631
)
# Classify by distance from border
result <- aoe_border(pts, border, width = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.