Filter for PurpleAir sensors within a specified distance from specified target coordinates.
pas_filterNear(pas = NULL, longitude = NULL, latitude = NULL, radius = "1 km")
PurpleAir pas object.
a Target longitude.
a Target latitude.
Distance from target with unit (i.e "15 km").
A subset of the given pas object.
radius
Should be a numeric string with a metric unit
separated by a space, such as "250 m"
.
library(AirSensor)
# Near Diamond Bar, CA
pas <- example_pas
diamond_bar <-
pas %>%
pas_filterNear(
longitude = -117.820833,
latitude = 34.001667,
radius = "20 km"
)
#> Maximum distance is > 100km. The 'cheap' measure is inaccurate over such
#> large distances, you'd likely be better using a different 'measure'.
if ( interactive() ) {
pas_leaflet(diamond_bar)
}