distref.raster: Transfrom reference raster as a network of paths for distance...

Description Usage Arguments Details Value

View source: R/Calculate_distances_functions.R

Description

Transfrom reference raster as a network of paths for distance calculation

Usage

1
2
3
4
5
6
7
8
distref.raster(
  r.ref,
  step.ang = 5,
  filename = paste0(tempdir(), "/dref.r.RData"),
  r.ref3D = FALSE,
  n.cores,
  save.rdists
)

Arguments

r.ref

Raster (1-layer) that will be used to calculate distances. Its resolution impacts precision on distances.

step.ang

Step for angles classes breaks (in degrees). This means that a distance error is allowed in future calculations. Distance error (%) = 100 * (1 - cos((step.ang/2)*pi/180)). With step.ang = 5 degrees, error < 0.1%. Default set to 5.

filename

Path where to save the dref.r issued from reference raster. This may be usefull for re-using the raster for different datasets. Default to paste0(tempdir(), "/dref.r.RData")

r.ref3D

Logical. Wether the reference raster should be used as a 3D surface to calculate distance accounting for elevation.

n.cores

number of cores to run parallel calculation. Default to all cores using parallel::detectCores()

save.rdists

optional. Path to file where to save the distances matrix between all non-NA raster cells. Saved as csv. If not provided, distances matrix will not be calculated as it may be to big to be stored in memory.

Details

Not all direct possible paths are calculated. Direct paths are retained in a focal window around cells. The size of the focal window is determined by the step.ang value. All paths retained are stored in a undirected graph (as from library igraph). All paths real distances are also stored to be weights for future points to points distances calculations.

Value

coords.r coordinates of all cells of the raster r.ref.NA.nb cell that are NA in the reference raster (obstacles) cell.Relpos.ngb row and col of neighbors retained after the angle calculation, relative to the cell of origin (moving window) cell.Relpos.cross row and col of cells crossed by lines between origin and neighbors, relative to the cell of origin (moving window)


statnmap/GeoDist documentation built on Feb. 4, 2020, 8:34 p.m.