get_barrier_intersect: Get distance between points taking into account barriers

Description Usage Arguments

View source: R/utils.R

Description

Given a set of lat/lon coordinates and a list of barriers in the form of polygons, returns the "distance" between points where distance is equal to the great-circle distance with a penalty applied if the line intersects a barrier. The exact way in which barriers modify distances can be varied (see barrier_method argument).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
get_barrier_intersect(
  node_long,
  node_lat,
  barrier_list = list(),
  barrier_penalty = numeric(),
  barrier_method = 1,
  max_barrier_range = Inf,
  eccentricity = 0.9,
  n_ell = 20
)

Arguments

node_long

longitudes of nodes.

node_lat

latitudes of nodes.

barrier_list

list of polygons representing barriers. Each element of the list must be a dataframe with columns long and lat specifying the coordinates of points that make up the polygon. Polygons must be complete rings, meaning the final row of the dataframe must equal the first row.

barrier_penalty

penalty values of each barrier. If a single value is provided then this value will be used for all barriers.

barrier_method

the method by which penalties are applied:

  1. compare pairwise lines to barriers. If the line intersects then add a fixed barrier_penalty to the spatial distance.

  2. compare pairwise lines to barriers. Calculate the intersection of the two, multiply this by the barrier_penalty and add to the spatial distance. For example, a barrier_penalty of 1 would mean there is double the "friction" when moving through a barrier.

  3. compare pairwise ellipses to barriers. Calculate the intersection area of the two, multiply this by the barrier_penalty and add to the spatial distance.

max_barrier_range

edges that are longer than this distance are unaffected by any barriers. Makes it possible to model barriers that only apply locally.

eccentricity

eccentricity of ellipses (only used under barrier_method = 3).

n_ell

number of points that make up an ellipse (only used under barrier_method = 3).


mrc-ide/PlasmoMAPI documentation built on Oct. 1, 2020, 9:41 a.m.