
Geographically search the air quality networks made available by openair::importMeta()
Source: R/network_searchNetwork.R
searchNetwork.RdWhile networkMap() visualises entire UK air quality networks,
searchNetwork() can subset specific networks to find air quality sites near
to a specific site of interest (for example, the location of known industrial
activity, or the centroid of a specific urban area).
Usage
searchNetwork(
lat,
lng,
source = "aurn",
year = NULL,
site_type = NULL,
variable = NULL,
max_dist = NULL,
n = NULL,
crs = 4326,
map = TRUE
)Arguments
- lat, lng
The decimal latitude(Y)/longitude(X).
required
Values representing the decimal latitude and longitude (or other Y/X coordinate if using a different
crs) of the site of interest.- source
One or more UK or European monitoring networks.
default:
"aurn"One or more air quality networks for which data is available through openair. Available networks include:
"aurn", The UK Automatic Urban and Rural Network."aqe", The Air Quality England Network."saqn", The Scottish Air Quality Network."waqn", The Welsh Air Quality Network."ni", The Northern Ireland Air Quality Network."local", Locally managed air quality networks in England."imperial", Imperial College London (formerly King's College London) networks."europe", European AirBase/e-reporting data.
There are two additional options provided for convenience:
"ukaq"will return metadata for all networks for which data is imported by importUKAQ() (i.e., AURN, AQE, SAQN, WAQN, NI, and the local networks)."all"will import all available metadata (i.e., "ukaq" plus "kcl" and "europe").
- year
A year, or range of years, with which to filter data.
default:
NULLBy default,
networkMap()visualises sites which are currently operational.yearallows users to show sites open in a specific year, or over a range of years. Seeopenair::importMeta()for more information.- site_type
One or more site types with which to subset the site metadata.
default:
NULLIf
site_typeis specified, only sites of that type will be searched for. For example,site_type = "urban background"will only search urban background sites.- variable
One or more variables of interest with which to subset the site metadata.
default:
NULLIf
variableis specified, only sites measuring at least one of these pollutants will be searched for. For example,variable = c("pm10", "co")will search sites that measure PM10 and/or CO.- max_dist
A maximum distance from the location of interest in kilometres.
default:
NULLIf
max_distis specified, only sites withinmax_distkilometres from thelat/lngcoordinate will be searched for.- n
The maximum number of sites to return.
default:
NULLIf
nis specified, onlynsites will be returned. Note that this filtering step is applied last, aftersite_type,variable, andmax_dist.- crs
The coordinate reference system (CRS).
default:
4326| scope: dynamic & staticThe coordinate reference system (CRS) of the data, passed to
sf::st_crs(). By default this is EPSG:4326, the CRS associated with the commonly used latitude and longitude coordinates. Different coordinate systems can be specified usingcrs(e.g.,crs = 27700for the British National Grid). Note that non-lat/lng coordinate systems will be re-projected to EPSG:4326 for plotting on the map.- map
Return a map?
default:
TRUEIf
TRUE, the default,searchNetwork()will return aleafletmap. IfFALSE, it will instead return a tibble.
Value
Either a tibble or leaflet map.
Details
Data subsetting progresses in the order in which the arguments are given;
first source and year, then site_type and variable, then max_dist,
and finally n.
See also
Other uk air quality network mapping functions:
networkMap()
Examples
if (FALSE) { # \dontrun{
# get all AURN sites open in 2020 within 20 km of Buckingham Palace
palace <- convertPostcode("SW1A1AA")
searchNetwork(lat = palace$lat, lng = palace$lng, max_dist = 20, year = 2020)
} # }