r - Raster package doesn't work with my shiny server -


i trying put script on shiny server. script working when type in r console. r script using shiny.

library(shiny) library(htmlwidgets) library(raster) library(leaflet) library(sp) library(rcurl)  # paths input / output files projectpath = "/srv/shiny-server/sample-apps/hello" imgpath = paste(projectpath,"/test.tif", sep = "")  # load raster image file r <- raster(imgpath) pal <- colornumeric(c("#ff0000", "#666666", "#ffffff"), values(r),                     na.color = "transparent")  r_colors <- rgb(t(col2rgb(colors()) / 255)) names(r_colors) <- colors()  ui <- fluidpage(   leafletoutput("mymap"),   p(),   actionbutton("recalc", "new points") )  server <- function(input, output, session) {    points <- eventreactive(input$recalc, {     cbind(rnorm(40) * 2 + 13, rnorm(40) + 48)   }, ignorenull = false)    output$mymap <- renderleaflet({     leaflet() %>%   addtiles() %>%   addrasterimage(r, colors=pal, opacity = 0.9, maxbytes = 123123123) %>%   addlegend(pal = pal, values = values(r), title = "salut")   }) }  shinyapp(ui, server) 

this random script need able show raster file on leaflet map , can't make work shiny-server. error :

error: cannot create rasterlayer object file. 

before line:

r <- raster(imgpath) 

do

print(imgpath) file.exists(imgpath) 

to check if correct. , check if rgdal can found:

library(rgdal) 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -