Returns a tibble of known locations from locationTbl, one for each incoming location. If no known location is found for a particular incoming location, that record in the tibble will contain all NA.

table_getNearestLocation(
  locationTbl = NULL,
  longitude = NULL,
  latitude = NULL,
  distanceThreshold = NULL
)

Arguments

locationTbl

Tibble of known locations.

longitude

Vector of longitudes in decimal degrees E.

latitude

Vector of latitudes in decimal degrees N.

distanceThreshold

Distance in meters.

Value

Tibble of known locations.

Examples

library(MazamaLocationUtils) locationTbl <- get(data("wa_monitors_500")) # Wenatchee lon <- -120.325278 lat <- 47.423333 # Too small a distanceThreshold will not find a match table_getNearestLocation(locationTbl, lon, lat, distanceThreshold = 50) %>% str()
#> tibble [1 × 13] (S3: tbl_df/tbl/data.frame) #> $ locationID : chr NA #> $ locationName: chr NA #> $ longitude : num NA #> $ latitude : num NA #> $ elevation : num NA #> $ countryCode : chr NA #> $ stateCode : chr NA #> $ countyName : chr NA #> $ timezone : chr NA #> $ houseNumber : chr NA #> $ street : chr NA #> $ city : chr NA #> $ zip : chr NA
# Expanding the distanceThreshold will find one table_getNearestLocation(locationTbl, lon, lat, distanceThreshold = 5000) %>% str()
#> tibble [1 × 13] (S3: tbl_df/tbl/data.frame) #> $ locationID : chr "8e54314f43eb8746" #> $ locationName: chr "us.wa_8e5431" #> $ longitude : num -120 #> $ latitude : num 47.4 #> $ elevation : num 249 #> $ countryCode : chr "US" #> $ stateCode : chr "WA" #> $ countyName : chr "Chelan" #> $ timezone : chr "America/Los_Angeles" #> $ houseNumber : chr NA #> $ street : chr NA #> $ city : chr "Wenatchee" #> $ zip : chr "98801"