Incoming 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 each location that is not already found in locationTbl.

table_addLocation(
  locationTbl = NULL,
  longitude = NULL,
  latitude = NULL,
  distanceThreshold = NULL,
  stateDataset = "NaturalEarthAdm1",
  elevationService = NULL,
  addressService = NULL,
  verbose = TRUE
)

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.

stateDataset

Name of spatial dataset to use for determining state codes, Default: 'NaturalEarthAdm1'

elevationService

Name of the elevation service to use for determining the elevation. Default: NULL. Accepted values: "usgs".

addressService

Name of the address service to use for determining the street address. Default: NULL. Accepted values: "photon".

verbose

Logical controlling the generation of progress messages.

Value

Updated tibble of known locations.

Note

This function is a vectorized version of table_addSingleLocation().

See also

Examples

# \donttest{ library(MazamaLocationUtils) # Set up standard directories and spatial data spatialDataDir <- tempdir() # typically "~/Data/Spatial" mazama_initialize(spatialDataDir) locationTbl <- get(data("wa_monitors_500")) # Coulee City, WA lon <- -119.290904 lat <- 47.611942 locationTbl <- locationTbl %>% table_addLocation(lon, lat, distanceThreshold = 500)
#> Working on -119.2909040, 47.6119420 ...
dplyr::glimpse(locationTbl)
#> Rows: 69 #> Columns: 13 #> $ locationID <chr> "ddbb565d51fe74ba", "f4ac27b3de8b9c19", "efce6225e8b2b1b8… #> $ locationName <chr> "us.wa_ddbb56", "us.wa_f4ac27", "us.wa_efce62", "us.wa_3b… #> $ longitude <dbl> -122.3383, -120.6647, -120.0231, -120.1051, -117.5890, -1… #> $ latitude <dbl> 47.55998, 47.59880, 47.83861, 48.35412, 47.64535, 47.8852… #> $ elevation <dbl> 3.19, 361.69, 338.56, 473.18, 729.72, 730.84, 13.03, 175.… #> $ countryCode <chr> "US", "US", "US", "US", "US", "US", "US", "US", "US", "US… #> $ stateCode <chr> "WA", "WA", "WA", "WA", "WA", "WA", "WA", "WA", "WA", "WA… #> $ countyName <chr> "King", "Chelan", "Chelan", "Okanogan", "Spokane", "Steve… #> $ timezone <chr> "America/Los_Angeles", "America/Los_Angeles", "America/Lo… #> $ houseNumber <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ street <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ city <chr> "Seattle", "Leavenworth", "Chelan", "Okanogan County", "A… #> $ zip <chr> "98106", "98826", "98816", "98856", "99001", "99040", "98…
# }