Work in progress. Polk County results from spring snapshot. May 23, 2023

Map

library(leaflet)
color_phosphate <- colorBin(c('green','yellow', 'red'), bins = c(0,0.5,2,10))
color_trans <- colorBin(c('red', 'yellow', 'green'), bins = c(0,15.5,35,65))
color_do <- colorBin(c('red', 'yellow', 'green', 'yellow'), bins = c(0,50,70,120,200))
color_chloride <- colorBin(c('green','yellow', 'red'), bins = c(0,50,250,1000))
color_nitrate <- colorBin(c('green','yellow', 'red'), bins = c(0,5,10,50))
color_acidity <- colorBin(c('red', 'yellow', 'green', 'yellow', 'red'), bins = c(0,6,7,8,10,12))
popper <-  ~paste0(site_name,
                          "<br/>Phosphate (mg/L)): ",
                          phosphate,
                    "<br/>Transparency (cm)): ",
                          transparency,
                   "<br/>Dissolved oxygen (mg/L): ",
                          dissolved_oxygen,
                   "<br/>Dissolved oxygen (% saturation): ",
                          dissolved_oxygen_saturation,
                   "<br/>Chloride (mg/L): ",
                          chloride,
                   "<br/>Nitrate (mg/L): ",
                          nitrate_n,
                                      "<br/>pH: ",
                          ph_units)

The color coding in the map is adapted from the Clean Water Hub. Good and excellent categories are combined, since some of the thresholds are outside the measurement range of our equipment. Green = Good or excellent Yellow = Fair. Red = Poor.

leaflet(polk_spring) %>%
  addTiles() %>%
  addCircleMarkers(data = polk_spring, group = "Transparency",
                   lng = ~lon, lat = ~lat,
                   color = ~color_trans(transparency),
                   radius = 6,
                   stroke = FALSE, fillOpacity = 100,
                   popup = popper) %>%
    addCircleMarkers(data = polk_spring, group = "Phosphate",
                     lng = ~lon, lat = ~lat,
                   color = ~color_phosphate(phosphate),
                   radius = 6,
                   stroke = FALSE, fillOpacity = 100,
                   popup = popper) %>%
      addCircleMarkers(data = polk_spring, group = "Dissolved oxygen",
                     lng = ~lon, lat = ~lat,
                   color = ~color_do(dissolved_oxygen_saturation),
                   radius = 6,
                   stroke = FALSE, fillOpacity = 100,
                   popup = popper) %>%
        addCircleMarkers(data = polk_spring, group = "Chloride",
                     lng = ~lon, lat = ~lat,
                   color = ~color_chloride(chloride),
                   radius = 6,
                   stroke = FALSE, fillOpacity = 100,
                   popup = popper) %>%
          addCircleMarkers(data = polk_spring, group = "Nitrate",
                     lng = ~lon, lat = ~lat,
                   color = ~color_nitrate(nitrate_n),
                   radius = 6,
                   stroke = FALSE, fillOpacity = 100,
                   popup = popper) %>%
            addCircleMarkers(data = polk_spring, group = "pH",
                     lng = ~lon, lat = ~lat,
                   color = ~color_acidity(ph_units),
                   radius = 6,
                   stroke = FALSE, fillOpacity = 100,
                   popup = popper) %>%
  # Layers control
  addLayersControl(baseGroups = c("Phosphate", "Transparency", "Dissolved oxygen",
                                  "Chloride", "Nitrate", "pH"),
                   options = layersControlOptions(collapsed = FALSE))