table_getDistanceFromTarget: Return distances and directions from a target location to...

View source: R/table_getDistanceFromTarget.R

table_getDistanceFromTargetR Documentation

Return distances and directions from a target location to known locations

Description

Returns a tibble with the same number of rows as locationTbl containing the distance and direction from the target location specified by longitude and latitude to each known location found in locationTbl.

Usage

table_getDistanceFromTarget(
  locationTbl = NULL,
  longitude = NULL,
  latitude = NULL,
  measure = c("geodesic", "haversine", "vincenty", "cheap")
)

Arguments

locationTbl

Tibble of known locations.

longitude

Target longitude in decimal degrees E.

latitude

Target latitude in decimal degrees N.

measure

One of "geodesic", "haversine", "vincenty" or "cheap" specifying desired method of geodesic distance calculation.

Value

Tibble of distances in meters and cardinal directions from a target location.

Note

Only a single target location is allowed.

Examples

library(MazamaLocationUtils)

locationTbl <- get(data("wa_monitors_500"))

locationTbl %>%
  table_getDistanceFromTarget(
    longitude = -117.3647, 
    latitude = 47.6725
  ) %>% 
  dplyr::glimpse()


MazamaLocationUtils documentation built on Sept. 11, 2024, 9:08 p.m.