Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stamen map not rendered in shiny -> receiving blank image #323

Open
ghost opened this issue Aug 1, 2021 · 1 comment
Open

Stamen map not rendered in shiny -> receiving blank image #323

ghost opened this issue Aug 1, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 1, 2021

I try to build some simple stamenmaps with ggmap in R-Shiny. I can't seem to get the map rendered. I only receive a blank image. The the simple example attached below:

library(ggmap)
library(shiny) 

server <- function(input, output) {

    map_ren <- renderPlot(get_stamenmap(
        bbox = c(
            left = 10,
            bottom = 30,
            right = 42,
            top = 34),
        maptype = "terrain",
        zoom = 3,
        force = TRUE
    ), width = 1000, height = 1000)
    
    output$map <- map_ren
}

ui <- fluidPage(
        plotOutput('map', width = 1000, height = 1000)
)

shinyApp(ui, server)

}, si = TRUE)
@ChristianSch
Copy link

This is an old issue, but in any case: This has nothing to do with shiny, but with wrong usage.

You're missing the ggmap call:

library(ggmap)
library(shiny) 

server <- function(input, output) {
  map_ren <- renderPlot(
    ggmap(get_stadiamap(
    bbox = c(
      left = 10,
      bottom = 30,
      right = 42,
      top = 34),
    maptype = "alidade_smooth",
    zoom = 3,
    force = TRUE
  )), width = 1000, height = 1000)
  
  output$map <- map_ren
}

ui <- fluidPage(
  plotOutput('map', width = 1000, height = 1000)
)

shinyApp(ui, server)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant