R/location_initialize.R
location_initialize.Rd
Creates a known location record with the following columns of core metadata:
locationID
locationName
longitude
latitude
elevation
countryCode
stateCode
countyName
timezone
houseNumber
street
city
postalCode
location_initialize(
longitude = NULL,
latitude = NULL,
stateDataset = "NaturalEarthAdm1",
elevationService = NULL,
addressService = NULL,
precision = 10,
verbose = TRUE
)
Single longitude in decimal degrees E.
Single latitude in decimal degrees N.
Name of spatial dataset to use for determining state
Name of the elevation service to use for determining the elevation. Default: NULL skips this step. Accepted values: "usgs".
Name of the address service to use for determining the street address. Default: NULL skips this step. Accepted values: "photon".
precision
argument passed on to location_createID.
Logical controlling the generation of progress messages.
Tibble with a single new known location.
# \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)
# Wenatchee
lon <- -120.325278
lat <- 47.423333
locationRecord <- location_initialize(lon, lat)
str(locationRecord)
}, silent = FALSE)
#> tibble [1 × 13] (S3: tbl_df/tbl/data.frame)
#> $ locationID : chr "c26mvcjucy"
#> $ locationName: chr "us.wa_c26mvc"
#> $ longitude : num -120
#> $ latitude : num 47.4
#> $ elevation : logi NA
#> $ countryCode : chr "US"
#> $ stateCode : chr "WA"
#> $ countyName : chr "Chelan"
#> $ timezone : chr "America/Los_Angeles"
#> $ houseNumber : chr NA
#> $ street : chr NA
#> $ city : chr NA
#> $ postalCode : chr NA
# }