
Compute spatial topology and weights for hexagonal smoothing
Source:R/compute_topology.R
compute_topology.RdFinds spatial neighbours and computes Gaussian-based weights for smoothing. Neighbours are computed up to `neighbor_orders` orders (1st-order = touching, 2nd-order = neighbours of neighbours, etc.). Weights decay with order using a Gaussian kernel.
Usage
compute_topology(
grid,
projection_crs = NULL,
neighbor_orders = 2,
sigma = NULL,
center_weight = 1,
neighbor_weights_param = NULL,
adaptive_sigma_factor = 0.5,
sample_size = 100
)Arguments
- grid
sf object with polygonal geometries (or a list of sf objects).
- projection_crs
CRS used for distance calculations. Default `NULL` selects an appropriate UTM zone via [`get_utm_crs()`].
- neighbor_orders
Number of neighbour orders (positive integer).
- sigma
Gaussian bandwidth. `NULL` (default) auto-computes from `avg_distance` and `adaptive_sigma_factor`.
- center_weight
Weight for the centre cell.
- neighbor_weights_param
Optional list of length `neighbor_orders` with per-order weights (overrides Gaussian computation).
- adaptive_sigma_factor
Scaling factor for auto-sigma.
- sample_size
Cells to sample for the average-distance estimate.