R/viz_rast.R

Defines functions viz_TWI viz_Def

Documented in viz_Def viz_TWI

#' Visualize 30m Climatic Water Deficit
#'
#' @return
#' @export
#'

viz_Def <- function(data) {

  defPal <- leaflet::colorQuantile("RdBu", def, reverse = TRUE, na.color = "transparent")
  data %>% leafem::addGeoRaster(def,
                         colors = defPal,
                         opacity = 0.5,
                         group = 'def') %>%
    leaflet::addLegend(pal = defPal, values = raster::values(def),
              title = "30m Water Deficit") %>%
    leafem::addImageQuery(def, project = TRUE,
                  layerId = "def")

}

#' Visualize 30m TWI
#'
#' @return

#'

viz_TWI <- function(data) {

  twiPal <- leaflet::colorQuantile("RdBu", twi, na.color = "transparent")
  data %>% leaflet::addRasterImage(twi,
                          colors = twiPal,
                          opacity = 0.5,
                          group = 'twi') %>%
    leaflet::addLegend(pal = twiPal, values = raster::values(twi),
              title = "10m TWI") %>%
    leafem::addImageQuery(data, project = TRUE,
                  layerId = "twi")

}
joshualerickson/resourceviz documentation built on Jan. 10, 2024, 4:57 p.m.