Skip to contents

Calculate (signed) distances between coordinates

Usage

.find_dists(
  grid,
  names = NULL,
  longlat = TRUE,
  origin = 1L,
  return_grid = FALSE,
  lon_ref,
  lat_ref
)

Arguments

grid

A matrix of 2D points, first column x/longitude, second column y/latitude.

names

Names of locations.

longlat

Logical, if TURE Great Circle (WGS84 ellipsoid) distance; if FALSE, Euclidean distance.

origin

Optional; used when longlat is TRUE. An integer index indicating the reference location which will be used as the origin.

return_grid

Logical; used when longlat is TRUE. If TRUE the mapped coordinates on a 2D plane is returned.

lon_ref

Reference longitude when computing the longitudinal distances. Default is the mean of longitudes in grid.

lat_ref

Reference latitude when computing the latitudinal distances. Default is the mean of latitudes in grid.

Value

List of signed distances.