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).

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:

  • compare line, apply fixed penalty if line intersects

  • compare line, apply penalty per unit intersection

  • compare ellipse, apply penalty per unit area intersection

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).