Skip to contents

Internal function to add a legend to TADA maps. Based on user inputs, the legend will display: circle markers based on ATTAINS assessment unit user ref, assessment unit overall status, ATTAINS assessment unit catchments, and assessment units identified by the user which are missing geometry in ATTAINS.

Usage

addTADAMapLegend(
  .data,
  map = NULL,
  icons = NULL,
  icon_labels = NULL,
  wqp = TRUE,
  ref_icons = TRUE,
  attains_au = TRUE,
  attains_missing = TRUE,
  nhd_attains = TRUE
)

Arguments

.data

A TADA data frame created with TADA_CreateATTAINSAUMLCrosswalk or TADA_CreateAUMLCrosswalk (called "TADA_with_ATTAINS" in the list of output dfs) or a subsetted TADA data frame containing all columns required for building map and pop up (Note: Add list of required columns (HRM 1/5/26)).

map

A leaflet map of TADA data to add the legend to.

icons

Character argument. The list of icon paths generated by the internal function getMapIconLabels. If already called in a larger mapping function, it can be referenced here (for efficiency). If icons = NULL, getMapIconLabels will run and fetch the list. Default is icons = NULL. This argument is only applied to for point AUs.

icon_labels

Character argument. The list of icon labels generated by the internal function getMapIconLabels. If already called in a larger mapping function, it can be referenced here (for efficiency). If icons = NULL, getMapIconLabels will run and fetch the list. Default is icons = NULL. This argument is only applied for point AUs.

wqp

Boolean argument. Determines whether WQP circle marker icons are displayed in the legend. When wqp = TRUE, the WQP markers are shown in the the legend. Default wqp = TRUE. The ref_icons param determines whether custom or solid fill circle markers are shown in the legend.

ref_icons

Boolean argument. Determines whether custom ref icons are displayed in the legend. When ref_icons = TRUE, the custom icons are shown in the legend. Default is ref_icons = TRUE.

attains_au

Boolean argument. Determines whether overall status for ATTAINS aus colors are shown in the legend. When attains_au = TRUE, the colors indicating ATTAINS assessment unit overall status are shown in the legend. Default is attains_au = TRUE.

attains_missing

Boolean argument. Determines whether the dashed circle indicating whether WQP sites with assessment units assigned by the user are missing corresponding geometry in ATTAINS is shown in the legend. The dashed circle icon is show when attains_missing = TRUE. The default is attains_missing = TRUE.

nhd_attains

Boolean argument. Determines whether the icon for NHD catchments containing ATTAINS features, a gray square with a black outline, is shown in the legend. When nhd_attains = TRUE, the icon is shown in the legend. Default is nhd_attains = TRUE.

Value

Custom leaflet legend for TADA maps.

Details

Suggested usage is to assign values to the wqp, ref_icons, attains_au, attains_missing, nhd_attains, and nhd_no_attains params as part of the workflow in larger TADA mapping functions (rather than relying on defaults) to ensure the resulting legend is appropriate for each map.