Good morning, community,
my goal is to create an online application that allows farmers to view the properties of their land.
I would like to give farmers the freedom to choose which soil ownership they want to view.
The output of the web app is as follows
Warning: Error in addRasterImage: inherits(x, "RasterLayer") is not TRUE
107:
I assure you that the files imported here are rasterlayers.
Could you help me
i attach the entire code
clay <- raster("C:/Users/Fiorentini/Desktop/Smart_Farming_App/data/argilla.tif")
sand <- raster("C:/Users/Fiorentini/Desktop/Smart_Farming_App/data/sabbia.tif")
ui<-fluidPage(
dashboardPage(
skin = "red",
dashboardHeader(title = "Soil Map", titleWidth = 350),
dashboardSidebar(width = 350,
sidebarMenu(
menuItem("Soil", tabName = "soil_maps", icon = icon("Map")))),
dashboardBody(
fluidRow(
tabItems(
tabItem(tabName = "soil_maps",
box(title = "Soil map visualization",
width = 3,
status ="danger",
solidHeader = TRUE,
collapsible = TRUE,
radioButtons("soil",
label = "Select the desired soil properties",
choices = list("clay" = clay,
"sand" = sand),
selected = 1),
leafletOutput(outputId = "soil_map", width = "100%", height = 500))))))))
server<-function(input, output) {
filteredData <- reactive({
as.raster(input$soil)
})
output$soil_map <- renderLeaflet({
leaflet() %>% addProviderTiles('Esri.WorldImagery') %>%
addRasterImage(filteredData)
})
}
shinyApp(ui = ui, server = server)