The function makes an API request to the OpenWeather Air Pollution API and fetches pollution data for a given location, then transforms the returned JSON object from the request into a ggplot chart.

get_air_pollution(lat, lon, api_key, fig_title = "")

Arguments

lat

Latitude for a given location as a double

lon

Longitude for a given location as a double

api_key

The API key for OpenWeather as a string

fig_title

The title of the returned ggplot as a string

Value

plotly object

Examples

get_air_pollution(49.28, 123.12, "APIKEY_example", "example title")
#> [1] "An error occurred fetching data from the API"