R/monitor_filterByDistance.R
monitor_filterByDistance.Rd
Filters the monitor
argument to include only those time series
located within a certain radius of a target location. If no time series fall
within the specified radius
, an empty mts_monitor object will
be returned.
When count
is used, a mts_monitor object is
created containing up to count
time series, ordered by
increasing distance from the target location. Note that the number
of monitors returned may be less than the specified count
value if
fewer than count
time series are found within the target area.
monitor_filterByDistance(
monitor,
longitude = NULL,
latitude = NULL,
radius = 50,
count = NULL,
addToMeta = FALSE
)
mts_monitor object.
Target longitude.
Target.
Distance (m) of radius defining a target area.
Number of time series to return.
Logical specifying whether to add distanceFromTarget
as a field in monitor$meta
.
A mts_monitor object with monitors near a location.
The returned mts_monitor will have an extra distance
. (A list with
meta
and data
dataframes.)
library(AirMonitor)
# Walla Walla
longitude <- -118.330278
latitude <- 46.065
Walla_Walla_monitors <-
NW_Megafires %>%
monitor_filterByDistance(
longitude = -118.330,
latitude = 46.065,
radius = 50000, # 50 km
addToMeta = TRUE
)
Walla_Walla_monitors %>%
monitor_getMeta() %>%
dplyr::select(c("locationName", "distanceFromTarget"))
#> # A tibble: 2 × 2
#> locationName distanceFromTarget
#> <chr> <dbl>
#> 1 Walla Wall - 12th St 1798
#> 2 Dayton - W Main 38732