fetch_len_multi: Calculate the fetch length for multiple points

View source: R/fetch_len.R

fetch_len_multiR Documentation

Calculate the fetch length for multiple points

Description

fetch_len_multi provides two methods to efficiently compute fetch length for multiple points.

Usage

fetch_len_multi(
  pts,
  bearings,
  shoreline,
  dmax,
  spread = 0,
  method = "btree",
  projected = FALSE
)

Arguments

pts

Simple features (sf or sfc) object containing point data.

bearings

Vector of bearings, in degrees.

shoreline

Simple feature (sf or sfc) object representing the shoreline, in either line or polygon format.

dmax

Maximum value of fetch length, returned if there is no land within a distance of dmax from a given bearing.

spread

Vector of relative bearings (in degrees) for which to calculate fetch around each main bearing.

method

Whether to use the "btree" (default) or "clip" method. See below for more details.

projected

Deprecated argument, kept for backwards compatibility.

Details

With method = "btree" (default), the fetch calculation for each point only uses the geometries within the shoreline layer that intersect with a rectangular buffer of size dmax around that point. (The name is based on a previous version of the function that implemented this method using the gBinarySTRtreeQuery function from the rgeos package.)

With method = "clip", the shoreline is clipped to its intersection with a polygon formed by the union of all the individual points' rectangular buffers.

In both cases, fetch_len is then applied to each point, using only the necessary portion of the shoreline.

Generally, the "clip" method will produce the biggest time savings when points are clustered within distances less than dmax (so their clipping rectangles overlap), whereas the "btree" method will be more efficient when the shoreline is composed of multiple geometrical objects and points are distant from each other.

Value

A matrix of fetch lengths, with one row by point in pts and one column by bearing in bearings.

See Also

fetch_len for details on the fetch length computation.


waver documentation built on Sept. 25, 2023, 1:08 a.m.