Function to toggle the rice fields layer on an existing leaflet map, and to select which attributes to use to define the symbology of the fields.

ff_layer_fields(
  m,
  show = TRUE,
  measure = "return",
  selected_return = NULL,
  selected_group = NULL,
  selected_object = NULL,
  inv_mass_days = 1
)

Arguments

m

An initialized leaflet map object or leafletProxy object.

show

A boolean value indicating whether the function call will be adding the layer to the map (TRUE) or removing the layer from the map (FALSE). Designed to be changed via shiny checkbox input by calling the function inside an observer.

measure

A string indicating the measure to show. Choose from return to color by return type, distance to color by distance to nearest fish-bearing stream, invmass to color by modeled invertebrate mass production, or wetdry to color by wet versus dry sides.

selected_return

The return_id of a return point to filter to, if desired.

selected_group

The group_id of a watershed to filter to, if desired.

selected_object

The object_id of a single field to filter to, if desired. Used internally.

inv_mass_days

For measure = "invmass", select the number of days to calculate the invertebrate mass production.

Examples

# show the layer on a leaflet map object ("m")
m <- ff_make_leaflet()
m |> ff_layer_fields(show = TRUE)