Skip to content

Commit

Permalink
added caching and popups to data tab
Browse files Browse the repository at this point in the history
  • Loading branch information
beth-ross committed Dec 20, 2023
1 parent c833952 commit e5bbe69
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions adapt_app/ADAPT_app/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ library(tidyterra)
#library(lwgeom)
library(shinyWidgets)
library(shinycssloaders)
library(cachem)

adapt_pts <- st_read("dat_short.shp")

Expand Down Expand Up @@ -69,6 +70,8 @@ source("R/species_input.R")
source("R/ssp_input.R")
source("R/time_input.R")

shinyOptions(cache= cachem::cache_disk("./"))

ui <- fluidPage(
tabsetPanel(
# Application title
Expand Down Expand Up @@ -201,7 +204,9 @@ server <- function(input, output, session) {
pal = pal(),
values = values(raster_subset()),
title = "Probability of Occupancy")
})
}) |>
bindCache(input$compare, input$time,input$species,
input$time_diff, input$ssp_diff, input$ssp)

output$download_raster <- downloadHandler(
filename = function() {
Expand Down Expand Up @@ -247,7 +252,8 @@ server <- function(input, output, session) {
data = only_obs(),
radius = ~(log(effort)+4),
color = ~ifelse(obs == 1,scico(4)[1],scico(4)[3]),
fillOpacity = 0.5
fillOpacity = 0.5,
popup = ~paste("Survey effort =",effort)
) |>
addLegend(
color = c(scico(4)[1],scico(4)[3]),
Expand Down

0 comments on commit e5bbe69

Please sign in to comment.