library(MazamaLocationUtils)
locationTbl <- get(data("wa_monitors_500"))
wa <- get(data("wa_airfire_meta"))
# We will merge some metadata from wa into locationTbl
# Record indices for wa
wa_indices <- seq(5,65,5)
wa_sub <- wa[wa_indices,]
locationID <-
table_getLocationID(
locationTbl,
wa_sub$longitude,
wa_sub$latitude,
distanceThreshold = 500
)
locationData <- wa_sub$AQSID
locationTbl <-
table_updateColumn(locationTbl, "AQSID", locationID, locationData)
# Look at the data we attempted to merge
wa$AQSID[wa_indices]
# And two columns from the updated locationTbl
locationTbl_indices <- table_getRecordIndex(locationTbl, locationID)
locationTbl[locationTbl_indices, c("city", "AQSID")]
Run the code above in your browser using DataLab