Mapview no longer renders in Shiny

I have an app thta includes an interactive mapping window using renderMapview. The app used to function jsut fine, but within the last week I have started receiving the following error:
"Warning: Error in exprToQuo: Don't know how to convert 'leaflet' to a function; a quosure or quoted expression was expected
55: stop
54: exprToQuo
53: exprToFunction
52: shiny::installExprFunction
51: htmlwidgets::shinyRenderWidget
50: renderMapview
49: server [#63]
Error in exprToQuo(expr, env, quoted = TRUE) :
Don't know how to convert 'leaflet' to a function; a quosure or quoted expression was expected"

It seems as though it is on the shiny side as I can still run the mapview component in an r session and they render just fine.

Hi, welcome!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at these resources, to see how to create one for a shiny app

I came across your error as well. Not sure how to fix it, though I would just use leaflet instead.

library(shiny)
library(shinydashboard)
library(mapview)

ui <- dashboardPage(
  dashboardHeader(title = "test"),
  dashboardSidebar(),
  dashboardBody(
    mapviewOutput("map")
  )
)

server <- function(input, output) {
  output$map <- renderMapview({
    mapview(breweries)
  })
}

shinyApp(ui, server)

Warning: Error in exprToQuo: Don't know how to convert 'leaflet' to a function; a quosure or quoted expression was expected
55: stop
54: exprToQuo
53: exprToFunction
52: shiny::installExprFunction
51: htmlwidgets::shinyRenderWidget
50: renderMapview
49: server [#2]
Error in exprToQuo(expr, env, quoted = TRUE) :
Don't know how to convert 'leaflet' to a function; a quosure or quoted expression was expected

The reprex worked for me to show a map, I'm using R version 4.0.5, shiny 1.6 and mapview 2.10

It doesn't work for me on:

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mapview_2.10.0       shinydashboard_0.7.2 shiny_1.7.0   

I am facing the same issue.

I have update all the package and now i am getting the same error.

I've raised a github issue:

Here is the response:

Yes, please use leafletOutput() and renderLeaflet() directly on the @map slot of the mapview map, i.e.

output$map<-renderLeaflet({
    mapview(franconia)@map
    # or 
    mapview::mapview2leaflet(mapview(franconia))
  })

Thanks for the info, glad to see it was not me missing something simple.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.