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.

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()
#> Rows: 78
#> Columns: 3
#> $ locationID          <chr> "c2913q48uk", "c28f8z9xq8", "c23hfxrdne", "c2k9v9b…
#> $ distanceFromTarget  <dbl> 370640, 401207, 368734, 106318, 206044, 402052, 41…
#> $ directionFromTarget <chr> "W", "W", "W", "S", "SW", "W", "W", "W", "W", "NE"…