R/table_getDistanceFromTarget.R
table_getDistanceFromTarget.Rd
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")
)
Tibble of known locations.
Target longitude in decimal degrees E.
Target latitude in decimal degrees N.
One of "geodesic", "haversine", "vincenty" or "cheap" specifying desired method of geodesic distance calculation.
Tibble of distances in meters and cardinal directions from a target location.
Only a single target location is allowed.
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"…