I want to upload a .tif file, in a shiny application, which you can download from here. Then I need to plot it and process it further. But Im not sure how can I upload and plot this kind of files in shiny.
library("devtools")
library("sp")
library("raster")
devtools::install_github("filipematias23/FIELDimageR")
library(FIELDimageR)
EX1<-stack("EX1_RGB.tif")
plotRGB(EX1, r = 1, g = 2, b = 3)
EX1.Crop <- fieldCrop(mosaic = EX1) # For heavy images (large, high resolution, etc.) please use: fast.plot=T
## app.R ##
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
fileInput(inputId = 'file1',
label = 'Upload Image',
placeholder = 'JPEG, PNG, and TIFF are supported',
accept = c(
"image/jpeg",
"image/x-png",
"image/tiff",
".jpg",
".png",
".tiff"))
),
dashboardBody()
)
options(shiny.maxRequestSize = 100 * 1024 ^ 2) # to acommodate larger images
server <- function(input, output) { }
shinyApp(ui, server)