| addPolarMarkers {openairmaps} | R Documentation | 
Add polar markers to leaflet map
Description
This function is similar (but not identical to) the leaflet::addMarkers()
and leaflet::addCircleMarkers() functions in leaflet, which allows users
to add openair directional analysis plots to any leaflet map and have more
control over groups and layerIds than in "all-in-one" functions like
polarMap().
Usage
addPolarMarkers(
  map,
  pollutant,
  fun = openair::polarPlot,
  lng = NULL,
  lat = NULL,
  layerId = NULL,
  group = NULL,
  popup = NULL,
  popupOptions = NULL,
  label = NULL,
  labelOptions = NULL,
  options = leaflet::markerOptions(),
  clusterOptions = NULL,
  clusterId = NULL,
  key = FALSE,
  d.icon = 200,
  d.fig = 3.5,
  data = leaflet::getMapData(map),
  ...
)
addPolarDiffMarkers(
  map,
  pollutant,
  before = leaflet::getMapData(map),
  after = leaflet::getMapData(map),
  lng = NULL,
  lat = NULL,
  layerId = NULL,
  group = NULL,
  popup = NULL,
  popupOptions = NULL,
  label = NULL,
  labelOptions = NULL,
  options = leaflet::markerOptions(),
  clusterOptions = NULL,
  clusterId = NULL,
  key = FALSE,
  d.icon = 200,
  d.fig = 3.5,
  ...
)
Arguments
| map | a map widget object created from  | 
| pollutant | The name of the pollutant to be plot. Note that, if  | 
| fun | An  | 
| lng | The decimal longitude. | 
| lat | The decimal latitude. | 
| layerId | the layer id | 
| group | the name of the group the newly created layers should belong to
(for  | 
| popup | A column of  | 
| popupOptions | A Vector of  | 
| label | A column of  | 
| labelOptions | A Vector of  | 
| options | a list of extra options for tile layers, popups, paths (circles, rectangles, polygons, ...), or other map elements | 
| clusterOptions | if not  | 
| clusterId | the id for the marker cluster layer | 
| key | Should a key for each marker be drawn? Default is  | 
| d.icon | The diameter of the plot on the map in pixels. This will affect
the size of the individual polar markers. Alternatively, a vector in the
form  | 
| d.fig | The diameter of the plots to be produced using  | 
| data | A data frame. The data frame must contain the data to plot your
choice of openair directional analysis plot, which includes wind speed
( | 
| ... | Other arguments for the plotting function (e.g.  | 
| before,after | A data frame that represents the before/after case. See
 | 
Value
A leaflet object.
Functions
-  addPolarMarkers(): Add any one-table polar marker (e.g.,openair::polarPlot())
-  addPolarDiffMarkers(): Add the two-tableopenair::polarDiff()marker.
See Also
shiny::runExample(package = "openairmaps") to see examples of this
function used in a shiny::shinyApp()
Examples
## Not run: 
library(leaflet)
library(openair)
# different types of polar plot on one map
leaflet(data = polar_data) %>%
  addTiles() %>%
  addPolarMarkers("ws",
    fun = openair::windRose,
    group = "Wind Rose"
  ) %>%
  addPolarMarkers("nox",
    fun = openair::polarPlot,
    group = "Polar Plot"
  ) %>%
  addLayersControl(
    baseGroups = c("Wind Rose", "Polar Plot")
  )
# use of polar diff (NB: both 'before' and 'after' inherit from `leaflet()`,
# so at least one should be overridden - in this case 'after')
leaflet(data = polar_data) %>%
  addTiles() %>%
  addPolarDiffMarkers("nox",
    after = dplyr::mutate(polar_data, nox = jitter(nox, 5))
  )
## End(Not run)