This function computes a kernel density estimate (KDE) heatmap from spatial points (settler particles) and returns a raster representation. The bounding box is expanded by a specified factor to avoid edge effects.
Arguments
- input
An sf object containing point geometries representing settler particles.
- xres
Numeric. The resolution of the heatmap in the x direction meters. Default is 20.
- yres
Numeric. The resolution of the heatmap in the y direction meters. Default is 20.
- buffer_factor
Numeric. The proportion of the bounding box range to expand the heatmap extent. Default is 0.1 10%.
Examples
if (FALSE) { # \dontrun{
library(sf)
library(terra)
# Example: Generate a random set of points
set.seed(123)
points_sf <- st_as_sf(data.frame(
X = runif(100, min = 1000, max = 2000),
Y = runif(100, min = 500, max = 1500)
), coords = c("X", "Y"), crs = 4326)
# Generate heatmap with 50m resolution and 10% buffer
heatmap <- settler_heatmap(points_sf, xres = 50, yres = 50, buffer_factor = 0.1)
# Plot result
plot(heatmap)
} # }