| monitor_filterByDistance {AirMonitor} | R Documentation |
Filter by distance from a target location
Description
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.
Usage
monitor_filterByDistance(
monitor,
longitude = NULL,
latitude = NULL,
radius = 50,
count = NULL,
addToMeta = FALSE
)
Arguments
monitor |
mts_monitor object. |
longitude |
Target longitude. |
latitude |
Target. |
radius |
Distance (m) of radius defining a target area. |
count |
Number of time series to return. |
addToMeta |
Logical specifying whether to add |
Value
A mts_monitor object with monitors near a location.
Note
The returned mts_monitor will have an extra distance. (A list with
meta and data dataframes.)
Examples
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"))