Filter for PurpleAir sensors within a specified distance from specified target coordinates.

pas_filterNear(pas = NULL, longitude = NULL, latitude = NULL, radius = "1 km")

Arguments

pas

PurpleAir pas object.

longitude

a Target longitude.

latitude

a Target latitude.

radius

Distance from target with unit (i.e "15 km").

Value

A subset of the given pas object.

Details

radius Should be a numeric string with a metric unit separated by a space, such as "250 m".

Examples

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)
}