Skip to contents

Internal/core function used by weighted_voronoi_domain() to compute a weighted Euclidean tessellation on a rasterised domain.

Usage

weighted_voronoi(
  points_sf,
  weight_col,
  boundary = NULL,
  template_rast = NULL,
  res = NULL,
  weight_transform = function(w) w,
  weight_model = c("multiplicative", "power", "additive"),
  weight_power = 1,
  method = c("argmin", "partition"),
  max_dist = NULL,
  verbose = TRUE,
  island_min_cells = 5,
  island_fill_iter = 50
)

Arguments

points_sf

An sf POINT object containing generator locations and attributes.

weight_col

Character. Name of the weight column in points_sf.

boundary

Optional sf polygon defining the tessellation domain. Used when template_rast is NULL.

template_rast

Optional terra::SpatRaster template raster. Provide this instead of boundary + res.

res

Numeric. Raster resolution in CRS units (e.g. metres).

weight_transform

Function. Transforms weights before allocation. Must return finite, strictly positive values.

weight_model

Character. One of "multiplicative", "power", or "additive". Controls how distances and weights combine into effective cost.

weight_power

Numeric > 0. Only used when weight_model = "power". Controls the distance exponent.

method

Character. Allocation method; one of "argmin" or "partition".

max_dist

Optional numeric. Maximum Euclidean distance to consider (euclidean only).

verbose

Logical. If TRUE, prints progress.

island_min_cells

Integer. Minimum patch size used in island removal.

island_fill_iter

Integer. Maximum iterations for filling reassigned cells.

Value

A list containing polygon output (if requested), allocation raster, and weights.