Skip to contents

Checks barrier crossings for multiple cell endpoints simultaneously using a single raster::extract() call instead of one per cell.

Usage

check_line_crosses_barrier_vectorized(
  x1,
  y1,
  x2,
  y2,
  raster,
  n_samples = 50,
  na_mask = NULL
)

Arguments

x1

Numeric. X coordinate of station

y1

Numeric. Y coordinate of station

x2

Numeric vector. X coordinates of all cells

y2

Numeric vector. Y coordinates of all cells

raster

RasterLayer to check for barriers

n_samples

Number of sample points per line (default 50)

na_mask

Logical vector. TRUE for cells to skip (NA distance)

Value

Logical vector: TRUE if line crosses barrier, NA if masked