routeKFS: Find shortest path through the Kitimat Fjord System

View source: R/routeKFS.R

routeKFSR Documentation

Find shortest path through the Kitimat Fjord System

Description

Determines the shortest traveling distance (i.e., swimming distance) between two points within the archipelago of the Kitimat Fjord System.

Usage

routeKFS(
  x1,
  y1,
  x2,
  y2,
  buffer = 0.01,
  show.progress = TRUE,
  plot.route = TRUE,
  plot.los = FALSE,
  print.turns = TRUE
)

Arguments

x1

Longitude of first point (negative decimal degrees)

y1

Latitude of first point

x2

Longitude of second point

y2

Latitude of second point

buffer

Passed to LOStest. It is the distance (in decimal degrees) to increase the boundaries of shoreline under consideration beyond the range defined by the two points.

show.progress

When TRUE (the default), each travel decision is printed to the console as it happens, with details on what nodes are being traveled between.

plot.route

When TRUE (the default), a map of the Kitimat Fjord System is shown, displaying the two points and the path taken between them. Grey dots are the travel nodes used to find shortest routes.

plot.los

Plotting toggle passed to the function LOStest. Default is FALSE. When TRUE, test of line of sight between each decision point is displayed. Good for troubleshooting.

print.turns

When TRUE (the default) The coordinates of each turn are printed to the console at the end of the process.

Details

An (imperfect) calculation of ecologically relevant distances between locations in the Kitimat Fjord System.

Value

Returns a two-element list: [[1]] the shortest possible swimming distance (km) between the two given points, and [[2]] the dataframe of turns with column names X and Y.

Author(s)

Eric Keen, Scripps Institution of Oceanography, ekeen@ucsd.edu

See Also

whalemap, LOStest, solve2lines

Examples

############ How far from Caamano Sound to Amy Point?
x1 <- -129.4 # Caamano Sound
y1  <- 52.9 
x2 <- -129.006958 # Amy Pt, north tip of Gribbell
y2 <- 53.53864484 
routeKFS(x1,y1,x2,y2) # Find distance
############
############ How far from Glide Island to Bishop Bay?
x1 <- -128.8489429 # Glide Island:
y1  <- 53.47139178
x2 <- -129.48349 # Bishop Bay:
y2 <- 53.01519634 
routeKFS(x1,y1,x2,y2) # Find distance
############
############ A straight-shot case: South Douglas to Central Wright
############ No maps or printing:
x1 <- -129.2 # Near Hartley Bay
y1  <- 53.35 
x2 <-  -129.22890579  # Wright Sound
y2 <-  53.41901713 
routeKFS(x1,y1,x2,y2,plot.route=FALSE,show.progress=FALSE,print.turns=FALSE) # Find distance
############
############ Threading the Casanave needle: Loredo to Leading Pt
x1 <- -129.19 # Loredo
y1  <- 52.84
x2 <-  -129.15 # Leading Pt
y2 <-  53.25 
routeKFS(x1,y1,x2,y2) # Find distance

ericmkeen/bangarang documentation built on Feb. 10, 2024, 2:58 p.m.