MazamaLocationUtils (version 0.4.3)

table_addLocation: Add new known location records to a table

Description

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.

Usage

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

Value

Updated tibble of known locations.

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 skips this step. Accepted values: "usgs".

addressService

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

verbose

Logical controlling the generation of progress messages.

See Also

table_addSingleLocation

table_removeRecord

table_updateSingleRecord

Examples

Run this code
# \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"))

  # Coulee City, WA
  lon <- -119.290904
  lat <- 47.611942

  locationTbl <- 
    locationTbl %>%
    table_addLocation(lon, lat, distanceThreshold = 500)
  
  dplyr::glimpse(locationTbl)
  
}, silent = FALSE)
# }

Run the code above in your browser using DataLab