this R Shiny app works just fine on its own, but when I deploy, it gives me out-of-memory errors in the logs. All it is doing is displaying a small (1-2MB) raster over the default map. I'd appreciate any suggestions.
# test the display of a GCS image.
library(shiny)
library(raster)
library(leaflet)
ui = fluidPage(
titlePanel("MountainSnow Map"),
helpText("Attempt to plot a raster"),
fluidRow(
column(12,
leafletOutput(outputId = 'map'),
fluidRow(
column(12,
verbatimTextOutput("info")),
fluidRow(
column(12,
plotOutput("distPlot")),
)
)
)
)
)
server <- function(input, output) {
tmp.url <- "/vsicurl/https://storage.googleapis.com/cso_test_upload/co_n_domain/swed_wi_assim/2023_04_01_swed_wi_assim.tif"
ras <- raster(tmp.url)
#ras <- writePNG(ras)
#cont. colormap option
#pal <- colorNumeric(c("#0C2C84", "#41B6C4", "#FFFFCC"), values(ras),
# na.color = "transparent")
#discrete colormap option
pal <- colorBin(c("#0C2C84", "#41B6C4", "#FFFFCC"), values(ras), 6, pretty = TRUE,
na.color = "transparent")
output$map = renderLeaflet({
leaflet() %>%
addTiles() %>%
addRasterImage(ras, colors = pal, opacity = 0.8) %>%
setView(lng = -110, lat = 40, zoom = 4) %>%
addLegend(pal = pal, values = values(ras), title = "SWE (m)")
})
}
# Run the application
shinyApp(ui = ui, server = server)