Assigns point features to polygon units using intersect, nearest, or intersect-nearest logic.
Usage
sj_join(
points,
polygons,
id_col,
name_col = NULL,
join_mode = c("intersect", "nearest", "intersect_nearest"),
repair_polygons = TRUE
)Arguments
- points
An sf point object.
- polygons
An sf polygon object containing target join units.
- id_col
Name of the polygon identifier column to attach to points.
- name_col
Optional polygon name column to attach to points.
- join_mode
Spatial join mode. One of
"intersect","nearest", or"intersect_nearest".- repair_polygons
Logical; if TRUE, repair polygon geometry before spatial predicates are evaluated.