R/table_addSingleLocation.R
table_addSingleLocation.RdIncoming longitude and latitude values are compared
against the incoming locationTbl to see if they are already within
distanceThreshold meters of an existing entry. A new record is created for
if the location is not already found in locationTbl.
table_addSingleLocation(
locationTbl = NULL,
longitude = NULL,
latitude = NULL,
distanceThreshold = NULL,
stateDataset = "NaturalEarthAdm1",
elevationService = NULL,
addressService = NULL,
verbose = TRUE
)Tibble of known locations.
Single longitude in decimal degrees E.
Single latitude in decimal degrees N.
Distance in meters.
Name of spatial dataset to use for determining state codes, Default: "NaturalEarthAdm1".
Name of the elevation service to use for determining the elevation. Default: NULL. Accepted values: "usgs".
Name of the address service to use for determining the street address. Default: NULL. Accepted values: "photon".
Logical controlling the generation of progress messages.
Updated tibble of known locations.
# \donttest{
library(MazamaLocationUtils)
# Fail gracefully if any resources are not available
try({
# Set up standard directories and spatial data
spatialDataDir <- tempdir() # typically "~/Data/Spatial"
initializeMazamaSpatialUtils(spatialDataDir)
locationTbl <- get(data("wa_monitors_500"))
nrow(locationTbl)
# Coulee City, WA
lon <- -119.290904
lat <- 47.611942
locationTbl <-
locationTbl %>%
table_addSingleLocation(lon, lat, distanceThreshold = 500)
nrow(locationTbl)
}, silent = FALSE)
#> [1] 79
# }