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

Description Usage Arguments Value See Also Examples

View source: R/table_addSingleLocation.R

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 if the location is not already found in locationTbl.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
table_addSingleLocation(
  locationTbl = NULL,
  longitude = NULL,
  latitude = NULL,
  distanceThreshold = NULL,
  stateDataset = "NaturalEarthAdm1",
  elevationService = NULL,
  addressService = NULL,
  verbose = TRUE
)

Arguments

locationTbl

Tibble of known locations.

longitude

Single longitude in decimal degrees E.

latitude

Single latitude 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.

See Also

table_addLocation

table_removeRecord

table_updateSingleRecord

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(MazamaLocationUtils)

# Fail gracefully if any resources are not available
try({

  # 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_addSingleLocation(lon, lat, distanceThreshold = 500)
  
}, silent = FALSE)

MazamaLocationUtils documentation built on Jan. 17, 2022, 1:06 a.m.