Add weather data to leaflet map.

add_weather(map, data, lng = NULL, lat = NULL, icon = NULL,
  template = NULL, popup = NULL, ...)

Arguments

map

leaflet map object

data

owm data

lng

numeric vector of longitudes (if NULL it will be taken from data)

lat

numeric vector of latitudes (if NULL it will be taken from data)

icon

vector of owm icon names (usually included in weather column of owm data)

template

template in the form of
"<b>{{name}}</b>"
where variable names in brackets correspond to column names of data (see also render)

popup

vector containing (HTML) content for popups, skipped in case parameter template is given

...

see addMarkers

Value

updated map object

Examples

# NOT RUN {
   owm_data <- find_city("Malaga", units = "metric") %>%
     owmr_as_tibble()
   map <- leaflet() %>% addTiles() %>%
     add_weather(
       owm_data,
       template = "<b>{{name}}</b>, {{temp}}°C",
       icon = owm_data$weather_icon
     )
# }