MazamaLocationUtils (version 0.1.6)

table_addSingleLocation: Add a single new known location record to a table

Description

Incoming longitude and latitude values are compared against the incoming locationTbl to see if the are already within radius meters of an existing entry. A new record is created for if the location is not already found in locationTbl.

Usage

table_addSingleLocation(locationTbl = NULL, longitude = NULL,
  latitude = NULL, radius = NULL, stateDataset = "NaturalEarthAdm1",
  verbose = TRUE)

Arguments

locationTbl

Tibble of known locations, Default: NULL

longitude

Single longitude in decimal degrees E, Default: NULL

latitude

Single latitude in decimal degrees N, Default: NULL

radius

Radius in meters, Default: NULL

stateDataset

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

verbose

Logical controlling the generation of progress messages.

Value

Updated tibble of known locations.

See Also

table_addLocation

table_removeRecord

table_updateSingleRecord

Examples

Run this code
# NOT RUN {
# Set up standard directories and spatial data
spatialDataDir <- tempdir() # typically "~/Data/Spatial"
MazamaSpatialUtils::setSpatialDataDir(spatialDataDir)

locationTbl <- get(data("wa_monitors_500"))

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

locationTbl <- 
  locationTbl %>%
  table_addSingleLocation(lon, lat, radius = 500)
# }

Run the code above in your browser using DataLab