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

mapview with fgb data not working in shiny - resource path error #308

Closed
DavZim opened this issue Jul 10, 2020 · 1 comment
Closed

mapview with fgb data not working in shiny - resource path error #308

DavZim opened this issue Jul 10, 2020 · 1 comment

Comments

@DavZim
Copy link

DavZim commented Jul 10, 2020

When using mapview with fgb enabled inside a shiny app, the error Error in addResourcePath: addResourcePath called with invalid prefix; please see documentation gets thrown. When disabling fgb or leaving out the colouring argument, the code works fine.

library(shiny)
library(leaflet)
library(mapview)
#> GDAL version >= 3.1.0 | setting mapviewOptions(fgb = TRUE)

# using
# mapviewOptions(fgb = FALSE)
# and the error disappears

ui <- fluidPage(
  leafletOutput("map")
)

server <- function(input, output, session) {
  output$map <- renderLeaflet(
    # when leaving out the zcol argument, the code works!
    mapview(franconia, zcol = "SHAPE_AREA")@map
  )
}

shinyApp(ui, server)
#> Listening on http://127.0.0.1:4374
#> Warning: Error in addResourcePath: addResourcePath called with invalid prefix; please see documentation
#>   [No stack trace available]

I think the issue is related to leafem#24.

To my understanding, the fgb functionality writes the polygons to some temporary file, which is not properly included into the shiny path, but I cant find the exact code. Using temporary files in shiny should work without changing the resource path.

@tim-salabim
Copy link
Member

The layerid, if zcol is present, had spaces that caused shiny to be unhappy. Should be fixed now

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

2 participants