2

I have build a Shiny App with one tab containing a map with points that can be analyzed in other tabs. I build this map using leaflet, but since my version of the map does exactly the same as the mapview package, i want to incorporate this in the app instead of the longer code using pure leaflet.

What i need: A map on which the user can select a base map (earth, open topo whatever) on which points containing data are projected. When hovering over the points, raw data is visible. I.e. Exactly what mapview does.

My spatial points are loaded using the sf package and work fine when using mapview outside of the shiny environment.

I tried to incorporate the mapview using this stack-question: filtering data reactively to generate maps

my code:

points <- read.sf("points.shp") 

ui <- fluidPage(
  tabsetPanel(
    
    # TAB I - MAPS
    tabPanel("Maps", fluid = TRUE,
            titlePanel("PQ-locations"),
            sidebarLayout(
              sidebarPanel(
              ),
              mainPanel(fluidRow(leafletOutput("mymap") 
                                
                                 )
                        )
            )
            )
            ))

server <- function(input, output, session){

output$mymap <- renderLeaflet({
  mapview(points)@map
 })
}

however, i get the following error on the page when launching the app:

Listening on http://127.0.0.1:7038
Warning: Error in value[[3L]]: Couldn't normalize path in `addResourcePath`, with arguments: `prefix` = 'PopupTable-0.0.1'; `directoryPath` = ''
  [No stack trace available]

I don't know what this means and why i get this error. This method of plotting mapview in shiny seems to work fine for other people.

Any help is much appreciated.

using latest versions of packages and R-Studio.

Regards

Stevestingray
  • 399
  • 2
  • 12
  • See https://github.com/r-spatial/mapview/issues/312. Should be fixed if you `devtools::install_github("r-spatial/mapview")`. – TimSalabim Jan 04 '21 at 10:39

0 Answers0