leafletThis function plots back trajectories on a leaflet map. This function
requires that data are imported using the openair::importTraj() function.
Options are provided to colour the individual trajectories (e.g., by
pollutant concentrations) or create "layer control" menus to show/hide
different layers.
trajMap(
data,
longitude = "lon",
latitude = "lat",
colour = NULL,
type = NULL,
cols = "default",
alpha = 0.5,
npoints = 12,
provider = "OpenStreetMap",
legend.position = "topright",
legend.title = NULL,
legend.title.autotext = TRUE,
control.collapsed = FALSE,
control.position = "topright",
control = NULL
)A leaflet object.
A data frame containing a HYSPLIT trajectory, perhaps accessed
with openair::importTraj().
required
A data frame containing HYSPLIT model outputs. If this data were not
obtained using openair::importTraj().
The decimal latitude/longitude.
default: "lat" / "lon"
Column names representing the decimal latitude and longitude.
Column to be used for colouring each trajectory.
default: NULL
This column may be numeric, character, factor or date(time). This will
commonly be a pollutant concentration which has been joined (e.g., by
dplyr::left_join()) to the trajectory data by "date".
A method to condition the data for separate plotting.
default: NULL
Used for splitting the trajectories into different groups which can be
selected between using a "layer control" menu. Passed to
openair::cutData().
Colours to use for plotting.
default: "default"
The colours used for plotting, passed to openair::openColours().
Transparency value for trajectories.
default: 1
A value between 0 (fully transparent) and 1 (fully opaque).
Interval at which points are placed along the trajectory paths.
default: 12
A dot is placed every npoints along each full trajectory. For hourly back
trajectories points are plotted every npoints hours. This helps to
understand where the air masses were at particular times and get a feel for
the speed of the air (points closer together correspond to slower moving
air masses). Defaults to 12.
The basemap to be used.
default: "OpenStreetMap"
A single leaflet::providers. See http://leaflet-extras.github.io/leaflet-providers/preview/ for a list of all base maps that can be used.
Position of the shared legend.
default: "topright"
Where should the legend be placed? One of "topright", "topright",
"bottomleft" or "bottomright". Passed to the position argument of
leaflet::addLegend(). NULL defaults to "topright".
Title of the legend.
default: NULL
By default, when legend.title = NULL, the function will attempt to
provide a sensible legend title based on colour. legend.title allows
users to overwrite this - for example, to include units or other contextual
information. Users may wish to use HTML tags to format the title.
Automatically format the title of the legend?
default: TRUE
When legend.title.autotext = TRUE, legend.title will be first run
through quickTextHTML().
Show the layer control as a collapsed?
default: FALSE
Should the "layer control" interface be collapsed? If TRUE, users will
have to hover over an icon to view the options.
Position of the layer control menu
default: "topright"
Where should the "layer control" interface be placed? One of "topleft",
"topright", "bottomleft" or "bottomright". Passed to the position
argument of leaflet::addLayersControl().
Deprecated. Please use type.
openair::trajPlot()
trajMapStatic() for the static ggplot2 equivalent of trajMap()
Other interactive trajectory maps:
trajLevelMap()
if (FALSE) {
trajMap(traj_data, colour = "pm10")
}
Run the code above in your browser using DataLab